链接到静态提升时未解析的外部符号

时间:2014-11-27 06:06:11

标签: c++ boost static-linking

我正在尝试构建我的应用程序并将其静态链接到Boost 1.57但我得到6个链接错误:

>LINK : warning LNK4044: unrecognized option '/static'; ignored
2>ShaderProgram.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ)
2>ShaderProgram.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat@system@boost@@YAXXZ)
2>ShaderProgram.obj : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,int> const &)" (?convert@path_traits@filesystem@boost@@YAXPBD0AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV?$codecvt@_WDH@5@@Z) referenced in function "public: __thiscall boost::filesystem::path::path<char const [8]>(char const (&)[8],void *)" (??$?0$$BY07$$CBD@path@filesystem@boost@@QAE@AAY07$$CBDPAX@Z)
2>ShaderProgram.obj : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert(wchar_t const *,wchar_t const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::codecvt<wchar_t,char,int> const &)" (?convert@path_traits@filesystem@boost@@YAXPB_W0AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$codecvt@_WDH@5@@Z) referenced in function "void __cdecl boost::filesystem::path_traits::convert(wchar_t const *,wchar_t const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?convert@path_traits@filesystem@boost@@YAXPB_W0AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
2>ShaderProgram.obj : error LNK2019: unresolved external symbol "public: class boost::filesystem::path & __thiscall boost::filesystem::path::operator/=(class boost::filesystem::path const &)" (??_0path@filesystem@boost@@QAEAAV012@ABV012@@Z) referenced in function "class boost::filesystem::path __cdecl boost::filesystem::operator/(class boost::filesystem::path const &,class boost::filesystem::path const &)" (??Kfilesystem@boost@@YA?AVpath@01@ABV201@0@Z)
2>ShaderProgram.obj : error LNK2019: unresolved external symbol "public: static class std::codecvt<wchar_t,char,int> const & __cdecl boost::filesystem::path::codecvt(void)" (?codecvt@path@filesystem@boost@@SAABV?$codecvt@_WDH@std@@XZ) referenced in function "public: __thiscall boost::filesystem::path::path<char const [8]>(char const (&)[8],void *)" (??$?0$$BY07$$CBD@path@filesystem@boost@@QAE@AAY07$$CBDPAX@Z)
2>C:\Users\Structo\Desktop\ReStructo\build-release\src\Release\ReStructo.exe : fatal error LNK1120: 6 unresolved externals

我做了什么:

  1. 我用以下方法建立了提升:

    b2 link=static variant=release runtime-link=static
    
  2. 在我的Cmake中,我有

    set(BUILD_SHARED_LIBS OFF)
    set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-static")
    set(Boost_USE_STATIC_RUNTIME ON)
    set(Boost_USE_STATIC_LIBS ON)
    set(Boost_USE_MULTITHREADED ON)
    find_package(Boost REQUIRED COMPONENTS filesystem system)
    
  3. 在Visual Studio 2013中 我将解决方案配置设置为Release 运行时库到多线程 在VC ++目录 - >库路径

  4. 中设置.libs的路径

    知道如何解决这个问题吗? 非常感谢你的时间!

0 个答案:

没有答案