开发者

C++ unresolved symbols

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜