antman8969
January 1st, 2011, 11:23 PM
Hi all,
I'm using Qt creator to try and port a media player application that I wrote in python to c++ to help teach myself, but I've run into a problem I cannot solve it seems.
I wrote a Song.h file and a SongCreator.cpp file that contains a few functions that don't belong to any class, such as recursively searching through a directory, which I use boost_filesystem to do.
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
/** Function for retrieving a list of all files in a top level directory
* recursively. Used to get a list of all of the songs in a file system.
*/
string* recursiveFileList(string& directory){
path p(directory);
string* files = new string[2400];
int i = 0;
recursive_directory_iterator end;
for(recursive_directory_iterator start(p); start != end; ++start){
string path = start->path().string();
files[i] = path;
i++;
}
return files;
}
It isn't done yet obviously (currently using 2400 as an arbitrary list size) but I've compiled it and ran test code in Eclipse linking the library with the -lboost_filesystem tag.
In Qt creator (qmake I suppose) I can only compile successfully when I DON'T #include <boost/filesystem.hpp>. I get this error if I include it:
error: undefined reference to `boost::system::generic_category()'
error: undefined reference to `boost::system::generic_category()'
error: undefined reference to `boost::system::system_category()'
among other 'undefined reference to' errors... This is obviously a problem because I need the recursive_directory_iterator.
I can compile it when I use a desktop build, but the maemo one gives me trouble, does anyone have any experience with this?
I'm using Qt creator to try and port a media player application that I wrote in python to c++ to help teach myself, but I've run into a problem I cannot solve it seems.
I wrote a Song.h file and a SongCreator.cpp file that contains a few functions that don't belong to any class, such as recursively searching through a directory, which I use boost_filesystem to do.
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
/** Function for retrieving a list of all files in a top level directory
* recursively. Used to get a list of all of the songs in a file system.
*/
string* recursiveFileList(string& directory){
path p(directory);
string* files = new string[2400];
int i = 0;
recursive_directory_iterator end;
for(recursive_directory_iterator start(p); start != end; ++start){
string path = start->path().string();
files[i] = path;
i++;
}
return files;
}
It isn't done yet obviously (currently using 2400 as an arbitrary list size) but I've compiled it and ran test code in Eclipse linking the library with the -lboost_filesystem tag.
In Qt creator (qmake I suppose) I can only compile successfully when I DON'T #include <boost/filesystem.hpp>. I get this error if I include it:
error: undefined reference to `boost::system::generic_category()'
error: undefined reference to `boost::system::generic_category()'
error: undefined reference to `boost::system::system_category()'
among other 'undefined reference to' errors... This is obviously a problem because I need the recursive_directory_iterator.
I can compile it when I use a desktop build, but the maemo one gives me trouble, does anyone have any experience with this?