c++linkeropenvdb

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,

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.


Solution

  • 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.