开发者

C++ unresolved symbols

开发者 https://www.devze.com 2022-12-11 17:25 出处:网络
I\'m getting an unresolved symbol error at linking in my proj. Im linking to an external library, and yes i have set up the configuration correctly, but when in Debug it outputs the following error fo

I'm getting an unresolved symbol error at linking in my proj. Im linking to an external library, and yes i have set up the configuration correctly, but when in Debug it outputs the following error for every class in the external library:

error LNK2001: unresolved external symbol __CAP_EXIT_Function

The proj uses the same runtime dll as the external library and links against the debug version of the lib.

Any clues as to where to go开发者_Python百科 with this?

BTW, im using VS2008

Thanks


It seems like you're using the /callcap switch but not defining the callback functions. Please see the previous link and implement the callback functions.

For other library linking errors. Check to make sure you are specifying the .lib file in the additional includes section of the Linker properties?

Also if you have a vcproj file in the same solution as your project, you can right click on your project and setup a dependency for the other library. In that way you don't need to specify an additional library as mentioned above.


Are you including all of the header files that may be needed? You still need to add

#include "MyDll.h"

Even after adding a reference to the dll and adding the directory where it is located to the include directories path. Then you can use the functions in the dll like so.

MyDll::MyFunctions::Function();


Is the lib a C lib? In that case you need the extern "C" for the functions in the header, maybe that is missing?

e.g.

extern "C"
{
  void foo(); 
   ...
}

or

   extern "C" void foo();
0

精彩评论

暂无评论...
验证码 换一张
取 消