我正在根据教程构建演示
https://www.boost.org/doc/libs/1_85_0/libs/serialization/doc/tutorial.html
我使用cmake for VS22和clang-cl.exe创建了项目,cmakefile.txt有
find_package( Boost REQUIRED COMPONENTS serialization )
if(Boost_FOUND)
message( "Boost found: ${Boost_INCLUDE_DIRS}" )
target_include_directories( ${PROJECT_NAME} PRIVATE ${Boost_INCLUDE_DIRS} )
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
endif()
并且我验证了该项目与
..\vcpkg_installed\x64-windows\debug\lib\boost_serialization-vc143-mt-gd-x64-1_85.lib
相关联。
我收到两个链接器错误:
lld-link : error : undefined symbol: __declspec(dllimport) public: void __cdecl boost::archive::archive_exception::`vbase dtor'(void)
lld-link : error : undefined symbol: public: void __cdecl boost::archive::archive_exception::`vbase dtor'(void)
使用 cl.exe 构建时,没有错误。
编辑
我按照建议打开了问题:
https://github.com/llvm/llvm-project/issues/111889 https://github.com/boostorg/serialization/issues/321
直到他们修复它(...),从类
virtual
的继承定义中删除单词archive_exception
。
位置:boost rchive rchive_exception.hpp,第 43 行。
class BOOST_SYMBOL_VISIBLE archive_exception :
public virtual std::exception