错误 LNK2019 无法解析的外部符号
对于这个问题,不知道是版本问题还是添加依赖库少了的问题,也可能是用cmake编译cpp文件时,写的CMakeLists.txt有点小问题,其他的头文件编译不会出错,就是可视化头文件这个::
#include <boost/thread/thread.hpp>这个头文件,不显示无法读取,但编译时会报错。
指示链接
https://learn.microsoft.com/zh-cn/cpp/error-messages/tool-errors/linker-tools-error-lnk2019?f1url=%3FappId%3DDev16IDEF1%26l%3DZH-CN%26k%3Dk(LNK2019)%26rd%3Dtrue&view=msvc-170
如果有清楚的,麻烦指点一下,谢谢。
错误显示
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK2019 无法解析的外部符号 "bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::mono_platform_timepoint const &)" (?interruptible_wait@this_thread@boost@@YA_NPEAXAEBUmono_platform_timepoint@detail@2@@Z),函数 "void __cdecl boost::this_thread::sleep<class boost::date_time::subsecond_duration<class boost::posix_time::time_duration,1000000> >(class boost::date_time::subsecond_duration<class boost::posix_time::time_duration,1000000> const &)" (??$sleep@V?$subsecond_duration@Vtime_duration@posix_time@boost@@$0PECEA@@date_time@boost@@@this_thread@boost@@YAXAEBV?$subsecond_duration@Vtime_duration@posix_time@boost@@$0PECEA@@date_time@1@@Z) 中引用了该符号 pcl E:\demo\build\julei.obj 1
最后发现是这个问题
添加boost
libboost_atomic-vc142-mt-x64-1_78.lib
libboost_bzip2-vc142-mt-x64-1_78.lib
libboost_chrono-vc142-mt-x64-1_78.lib
libboost_container-vc142-mt-x64-1_78.lib
libboost_context-vc142-mt-x64-1_78.lib
libboost_contract-vc142-mt-x64-1_78.lib
libboost_coroutine-vc142-mt-x64-1_78.lib
libboost_date_time-vc142-mt-x64-1_78.lib
libboost_exception-vc142-mt-x64-1_78.lib
libboost_filesystem-vc142-mt-x64-1_78.lib
libboost_graph-vc142-mt-x64-1_78.lib
libboost_graph_parallel-vc142-mt-x64-1_78.lib
libboost_iostreams-vc142-mt-x64-1_78.lib
libboost_json-vc142-mt-x64-1_78.lib
libboost_locale-vc142-mt-x64-1_78.lib
libboost_log-vc142-mt-x64-1_78.lib
libboost_log_setup-vc142-mt-x64-1_78.lib
libboost_math_c99-vc142-mt-x64-1_78.lib
libboost_math_c99f-vc142-mt-x64-1_78.lib
libboost_math_c99l-vc142-mt-x64-1_78.lib
libboost_math_tr1-vc142-mt-x64-1_78.lib
libboost_math_tr1f-vc142-mt-x64-1_78.lib
libboost_math_tr1l-vc142-mt-x64-1_78.lib
libboost_mpi-vc142-mt-x64-1_78.lib
libboost_nowide-vc142-mt-x64-1_78.lib
libboost_numpy38-vc142-mt-x64-1_78.lib
libboost_prg_exec_monitor-vc142-mt-x64-1_78.lib
libboost_program_options-vc142-mt-x64-1_78.lib
libboost_python38-vc142-mt-x64-1_78.lib
libboost_random-vc142-mt-x64-1_78.lib
libboost_regex-vc142-mt-x64-1_78.lib
libboost_serialization-vc142-mt-x64-1_78.lib
libboost_system-vc142-mt-x64-1_78.lib
libboost_test_exec_monitor-vc142-mt-x64-1_78.lib
libboost_thread-vc142-mt-x64-1_78.lib
libboost_timer-vc142-mt-x64-1_78.lib
libboost_type_erasure-vc142-mt-x64-1_78.lib
libboost_unit_test_framework-vc142-mt-x64-1_78.lib
libboost_wave-vc142-mt-x64-1_78.lib
libboost_wserialization-vc142-mt-x64-1_78.lib
libboost_zlib-vc142-mt-x64-1_78.lib