c++ - Error using boost::filesystem -
I am trying to read .txt files in all the given folders, and I use Boost libraries for it I am trying to:
Integer file load :: ReadtextFile (Const. String :: string folder) {int loadStatus = LOAD_OK; // Check whether the given folder exists if (boost :: filesystem :: is_directory (folder)) // // Promote existing text files: filesystem :: directory_iterator end_iter; (Boost :: filesystem :: directory_iterator dir_itr (dir_itr! = End_iter; dir_itr ++) (boost :: filesystem :: path filePath; Try {// Check if this is a file if (boost :: Filesystem :: is_regular_file (dir_itr-> Position ())) {filePath = dir_itr-> Path (); // Check that this .txt extension is the std :: string file extension = dir_itr-> path ). Extension (). String (); // case insensitive comparison (if: :: extension, file extension, ".txt")) {// is the code used as filename ID, when file text database Datab In truth std :: string fileName = dir_itr- & gt; . (). System () string (); Std :: istringstream (fileName); Unsigned int entry; Is & gt; & Gt; EntryId; // Check whether an entry with that code ID exists currently // if the database (! DATABASE :: CheckIfEntryExists (entryId)) // Process text file loadStatus = ProcessFile (filePath.string ()); }}}} Hold (const std :: exception and ex) {std :: cerr & lt; & Lt; "[FILE] Error trying to open file" & lt; & Lt; FilePath.string () & lt; & Lt; Std :: endl; }}} Return loadstats; } But I am reusing two compiler errors:
To promote undefined context: :: filesystem3 :: path :: Extension () const 'undefined reference to `boost :: filesystem 3 :: path :: stem () const' I have the following imports in the class header file:
#include "boost / algorithm / string.hpp" #include "boost / filesystem / operations.hpp" #include "boost / filesystem / path.hpp" (Among others that are not relevant, like)
I Or am I doing?
You must link to solve linker errors -lboost_filesystem -lboost_system ,
Boost file system depends on the other compiled components available in those libraries.
Comments
Post a Comment