error using directory_entry in boost filesystem -


i'm starting use boost library in c++ programs using code blocks on ubuntu.

i encounter problem while manipulating files, following code returns segmentation fault :

#include <iostream> #include <boost/filesystem.hpp>  using namespace std;  int main() {     boost::filesystem::path my_file("/home/malinou/workspace/grunbaum2/grunbaum/bases/config.txt");     cout << "my_file path : " << my_file.string() << endl;     cout << "my_file exists : " << boost::filesystem::exists(my_file.string()) << endl;     cout << "my_file path : " << my_file.string() << endl;     return 0; } 

i'm using gcc compiler flags -lboost_system , -lboost_filesystem, , console output :

my_file path : /home/malinou/workspace/grunbaum2/grunbaum/bases/config.txt my_file exists : 1 segmentation fault (core dumped)  process returned 139 (0x8b)   execution time : 0.093 s press enter continue. 

any idea why my_file seems cause problem after calling exists() function?

(p.s: problem same when call is_regular_file() function instead of exists() one.)

to answer question, seemed linking error due ide used. created new project same files, , worked perfectly...weird

anyway, everyones' help!


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -