내가 특정 폴더에있는 모든 .txt 인 파일을 읽을려고, 나는 그것에 대해 부스트 라이브러리를 사용하는 것을 시도하고있다 :오류 사용하여 부스트 : : 파일 시스템
int FileLoad::ReadTxtFiles(const std::string folder){
int loadStatus = LOAD_OK;
// Check if given folder exists
if(boost::filesystem::is_directory(folder)){
// Iterate existing text files
boost::filesystem::directory_iterator end_iter;
for(boost::filesystem::directory_iterator dir_itr(folder);
dir_itr!=end_iter; dir_itr++){
boost::filesystem::path filePath;
try{
// Check if it is a file
if(boost::filesystem::is_regular_file(dir_itr->status())){
filePath = dir_itr->path();
// Check that it is .txt extension
std::string fileExtension =
dir_itr->path().extension().string(); // Case insensitive comparison
if(boost::iequals(fileExtension, ".txt")){
// Filename is the code used as id when the file text is loaded to a database
std::string fileName = dir_itr->path().stem().string();
std::istringstream is(fileName);
unsigned int entryId;
is >> entryId;
// Check if an entry with that code id currently exists
// at the database
if(!DATABASE::CheckIfEntryExists(entryId)){
// Process text file
loadStatus = ProcessFile(filePath.string());
}
}
}
}
catch(const std::exception& ex){
std::cerr << " [FILE] Error trying to open file " <<
filePath.string() << std::endl;
}
}
}
return loadStatus;
}
을하지만 두 개의 컴파일러 오류를 reeiving하고 있습니다 :
undefined reference to `boost::filesystem3::path::extension() const'
undefined reference to `boost::filesystem3::path::stem() const'
내가 가지고있는 클래스 헤더 파일에 다음 수입 : 관련이없는 다른 사람들 중에서
#include "boost/algorithm/string.hpp"
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/path.hpp"
(S uch)
내가 뭘 잘못하고 있니?