简体   繁体   中英

OpenVDB linker error: unresolved external symbols

I wish to use OpenVDB library in a project. The library has compiled successfully on Windows7 x64 in release version using \\MD (as described in https://github.com/rchoetzlein/win_openvdb ). The OpenVDB_cookbook compiles and executes successfully as well. If I put my own code in cookbook, it compiles and executes successfully as well.

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,

it throws a linker error 'LNK2019: unresolved external symbols "void_cdecl openvdb::v3_0_0::initialize(void)" referenced in function main'

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.

Thank you for the help.

The problem was solved by adding dir\\src. and dir\\src.. to Additional Include Directories under properties->C/C++->General. Where dir is the directory where the source and build is. I don't know why I had to add this though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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