简体   繁体   中英

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

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

eg

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

or

   extern "C" void foo();

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();

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