我在windows中构建GTSAm,现在我尝试用它构建示例应用程序。
示例应用程序非常简单(它是GTSAM的一部分),但是当我运行它时,我得到了这个链接器错误:
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol __imp_clock referenced in function gk_CPUSeconds example D:\MyData\SourceCode\gtsam_win\cmake\example_cmake_find_gtsam\build\metis-gtsamDebug.lib(timers.obj) 和
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol __imp__time64 referenced in function time example D:\MyData\SourceCode\gtsam_win\cmake\example_cmake_find_gtsam\build\metis-gtsamDebug.lib(timers.obj) 1 搜索结果显示,这两个函数是MSVC库的一部分,它们应该链接到系统中。
我怎样才能解决这个问题?
问题似乎是在库构建过程中设置与应用程序构建之间的错误匹配,但我发现没有任何链接设置不同。在哪里可以找到这样的差别?
发布于 2021-07-11 13:58:59
来自链接库的未解析外部运行库符号中的__imp_前缀意味着库是用DLL运行时构建的(/MD in C++ -> Code Generation -> Runtime Library)。
如果使用静态运行时(/MT)构建应用程序,则来自DLL运行时的符号将无法解决。所有编译单元的运行时设置应该相同。
https://stackoverflow.com/questions/68330445
复制相似问题