G
Gary Wessle
hi
I did not find any way to traverse a given directory in c++ till I
found boost, not sure if there many boost(ers) out here. but this is
given me some error I cannot locate a fix.
thanks
**************** 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:ath 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:ath:ath(char const*)'
/home/fred/myPrograms/backtest/try/try.cpp:12: undefined reference to `boost::filesystem::exists(boost::filesystem:ath const&)'
collect2: ld returned 1 exit status
make: *** [proj] Error 1
I did not find any way to traverse a given directory in c++ till I
found boost, not sure if there many boost(ers) out here. but this is
given me some error I cannot locate a fix.
thanks
**************** 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:ath 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:ath:ath(char const*)'
/home/fred/myPrograms/backtest/try/try.cpp:12: undefined reference to `boost::filesystem::exists(boost::filesystem:ath const&)'
collect2: ld returned 1 exit status
make: *** [proj] Error 1