こんにちは、Visual Studio 2010 を使用しています。Qt のアドインを追加し、最後のブースト パッケージを手動でビルドしました。今、私は新しいプロジェクト、qt ウィンドウ アプリケーションを開始しました。
そこで私は次のコードを使用しました:
#include <boost/filesystem.hpp>
int main(int argc, char *argv[])
{
boost::filesystem::path p("c:/test/test.gmx");
boost::filesystem::path ext(p.extension());
boost::filesystem::path name(p.leaf().replace_extension(""));
//QApplication a(argc, argv);
//MainInterface w;
//w.show();
//return a.exec();
}
ただし、これは失敗するようです..まったく同じコードを使用するが、代わりにqtテンプレートを使用しない場合は機能します。正確なエラーは次のとおりです。
1>main.obj : error LNK2019: unresolved external symbol "private: static class std::codecvt<unsigned short,char,int> const * & __cdecl boost::filesystem3::path::wchar_t_codecvt_facet(void)" (?wchar_t_codecvt_facet@path@filesystem3@boost@@CAAAPBV?$codecvt@GDH@std@@XZ) referenced in function "public: static class std::codecvt<unsigned short,char,int> const & __cdecl boost::filesystem3::path::codecvt(void)" (?codecvt@path@filesystem3@boost@@SAABV?$codecvt@GDH@std@@XZ)
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(char const *,char const *,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > &,class std::codecvt<unsigned short,char,int> const &)" (?convert@path_traits@filesystem3@boost@@YAXPBD0AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@ABV?$codecvt@GDH@5@@Z) referenced in function "void __cdecl boost::filesystem3::path_traits::dispatch<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > &,class std::codecvt<unsigned short,char,int> const &)" (??$dispatch@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@path_traits@filesystem3@boost@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@4@ABV?$codecvt@GDH@4@@Z)
明らかな設定を調べてみました。ただし、プロジェクトのプロパティでは、ブースト ライブラリ ディレクトリは依然として VC++ ディレクトリ -> ライブラリ ディレクトリの下にあります。
これは何が原因ですか?これを解決するにはどうすればよいですか?