0
我已經下載了violetland的中繼庫,我得到錯誤Type 'boost::filesystem::path' could not be resolved
。 我已經安裝了boost庫,並且還包含boost/filesystem.hpp
。類型「boost :: filesystem :: path」無法解析
我該如何解決這個問題?
系統:
- Linux Mint的13 64
- 日食靛藍
- 要求更多的信息,如果你需要他們。
Codesample:
#ifndef FILEUTILITY_H_
#define FILEUTILITY_H_
#include <vector>
#include <sys/stat.h>
#include <cstdlib>
#include <string>
#include <boost/filesystem.hpp>
class FileUtility {
private:
boost::filesystem::path m_appPath, m_resPath, m_usrPath;
public:
enum PathType {
common = 0, image, anima, sound, music, monsters, weapon, user
};
FileUtility(char *argPath);
static void truncateFullPathToDir(char *path);
void traceResPath();
void setFullResPath(std::string path);
boost::filesystem::path getFullPath(PathType type, std::string resource) const;
std::vector<std::string> getFilesFromDir(boost::filesystem::path dir);
unsigned int getFilesCountFromDir(boost::filesystem::path dir);
std::vector<std::string> getSubDirsFromDir(boost::filesystem::path dir);
unsigned int getSubDirsCountFromDir(boost::filesystem::path dir);
};
#endif /* FILEUTILITY_H_ */
類似於上述的boost::filesystem::path
每次使用被標記爲錯誤。
你得到一個編譯器錯誤或鏈接錯誤?你說你已經包含了標題,但是你有沒有鏈接到圖書館? – chris
錯誤類型是「語義錯誤」。 「與圖書館聯繫」是什麼意思? (對不起,我只有基本的編碼技能,我只想嘗試比helloworld更大的東西;)) – wullxz
在你用來構建它的行中,你需要一個'-lboost_filesystem'或者任何它的庫。如果你沒有鏈接,編譯器可以找到聲明,但鏈接器找不到主體。 – chris