c++visual-studio-2008unmanagedlnk2019tetgen

LNK 2028 - 2019 / Managed and Unmanaged C++ ? (VS 2008)


I am trying to link an open-source library to one of my project. The library is unmanaged (named Tetgen) and my project is in managed C++.

My project recognizes the header and can use the functions defined in it. But I get a 2028 error each time it wants to access to some methods defined in the .cpp:

error LNK2028: unresolved token (0A000E20) "public: void __thiscall tetgenio::save_nodes(char const *)" (?save_nodes@tetgenio@@$$FQAEXPBD@Z) referenced in function "public: virtual bool __thiscall ForwardModelingPlugin::CustomMeshVol3D::tesselate(void)" (?tesselate@CustomMeshVol3D@ForwardModelingPlugin@@$$FUAE_NXZ)

I have tried to create a test function:

int tetgenio::Test(int i) {  
    return i;  
}

...and another Testbis function, defined in the header. Testbis works, Test gives a 2028 error.

I have compared the .obj of my project and the .lib created, and for the lib there is:

save_nodes@tetgenio@@QAEXPAD@Z

But in the .obj it is:

save_nodes@tetgenio@@$$FQAEXPBD@Z in the .obj

It appears they are not the same.

Everything is compiled with /clr. I've tried creating both a .lib and a .dll, with same results either way.


Solution

  • That was because of a linker problem linking to different folders containing the same files.