는 C와 함께 설치된 라이브러리없이 ++ 응용 프로그램 부스트를 사용하려고 할 때 나는 우분투 12.10에 오류가 발생했습니다 :이 코드에서
[email protected]:~/foo8/33_parse_file$ g++ -o s s.cpp
s.cpp:3:29: fatal error: boost/foreach.hpp: No such file or directory
compilation terminated.
:
를
#include <iostream>
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
using namespace std;
int main(){
cout << "hi";
}
나는 Ubu에 있습니다. 12.10과 같이 부스트를 설치했습니다.
sudo apt-get install libboost-all-dev
그런 다음 다시 컴파일하면 작동하고 이제는 부스트를 사용할 수 있습니다!
#include <iostream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
using namespace std;
using namespace boost;
int main(int argc, char** argv)
{
string text = "token test\tstring";
char_separator<char> sep(" \t");
tokenizer<char_separator<char> > tokens(text, sep);
BOOST_FOREACH(string t, tokens)
{
cout << t << "." << endl;
}
}
은 세 단어 token
, test
, string
당신이이 경로를 포함 업데이트 한 이유를 인쇄? –
g ++ -I -c * .cpp –
Arunmu
"적절한 libs 폴더"에 복사했다고 말하면 어떤 폴더가 될까요? – janitor048