简体   繁体   English

OpenVDB链接器错误:无法解析的外部符号

[英]OpenVDB linker error: unresolved external symbols

I wish to use OpenVDB library in a project. 我希望在项目中使用OpenVDB库。 The library has compiled successfully on Windows7 x64 in release version using \\MD (as described in https://github.com/rchoetzlein/win_openvdb ). 该库已使用\\ MD在Windows7 x64发行版上成功编译(如https://github.com/rchoetzlein/win_openvdb中所述 )。 The OpenVDB_cookbook compiles and executes successfully as well. OpenVDB_cookbook也会编译并成功执行。 If I put my own code in cookbook, it compiles and executes successfully as well. 如果我将自己的代码放入Cookbook,它也会编译并成功执行。

But, 但,

  • If I link the library to an existing project, 如果我将库链接到现有项目,

  • or I copy paste the same code (from cookbook) in a new project and use the same cmakelists.txt, Find*.cmake files and all the same options from project properties as from the cookbook, 或我将相同的代码(来自食谱)复制粘贴到新项目中,并使用相同的cmakelists.txt,Find * .cmake文件以及项目属性中与菜谱相同的所有选项,

it throws a linker error 'LNK2019: unresolved external symbols "void_cdecl openvdb::v3_0_0::initialize(void)" referenced in function main' 会引发链接器错误“ LNK2019:函数main中引用的未解决的外部符号“ void_cdecl openvdb :: v3_0_0 :: initialize(void)””

Even the simplest code of the form: 即使是最简单的形式的代码:

#include <openvdb.h>
void main()
{
    openvdb::initialize();
}

throws this linker error. 引发此链接器错误。

Any ideas what am I doing wrong? 有什么想法我做错了吗? I am on it for a few days and haven't been able to solve it. 我在上面呆了几天,一直无法解决。

All libraries IlmBase, OpenEXR, glew, glfw, boost and OpenVDB are successfully linked using cmake and are present in the project properties page. 使用cmake成功链接了所有库IlmBase,OpenEXR,glew,glfw,boost和OpenVDB,这些库都存在于项目属性页中。

Thank you for the help. 感谢您的帮助。

The problem was solved by adding dir\\src. 通过添加dir \\ src解决了该问题。 and dir\\src.. to Additional Include Directories under properties->C/C++->General. 和dir \\ src ..到Properties-> C / C ++-> General下的Additional Include Directories。 Where dir is the directory where the source and build is. 其中dir是源和构建所在的目录。 I don't know why I had to add this though. 我不知道为什么我必须添加这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM