# phddas@yahoo.com / 2006-08-05 21:14:25 -0700:
**************** code **************** #include <iostream> #include <string> #include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp #include "boost/filesystem/fstream.hpp" namespace fs = boost::filesystem;
using namespace std;
int main(){
fs::path full_path("../data"); if (exists(full_path)) cout << "yes" << endl;
} //there exists data directory in the parent of the current directory.
**************** error **************** $ make g++ -gdwarf-2 -c -o try.o try.cpp g++ -Wall -gdwarf-2 -o proj try.o try.o: In function `main': /home/fred/myPrograms/backtest/try/try.cpp:11: undefined reference to `boost::filesystem::path::path(char const*)' /home/fred/myPrograms/backtest/try/try.cpp:12: undefined reference to `boost::filesystem::exists(boost::filesystem::path const&)' collect2: ld returned 1 exit status make: *** [proj] Error 1
You need to link with libboost_filesystem.a or libboost_filesystem.so. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991