Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I get LNK2028 when trying to wrap native c++ class using managed c++

trying to wrap a native cpp class using managed c++ class.

all looks good but for some reason it wont compile.

getting the following linker errors:

Error 25 error LNK2028: unresolved token (0A0002CE) Error 27 error LNK2019: unresolved external symbol

Any ideas how do I fix this one ? :\

well, here is a full error of one of the functions:

Error 20 error LNK2028: unresolved token (0A0002CF) "public: bool __thiscall RCSclient::ResumeChannel(char *,int,__int64)" (?ResumeChannel@RCSclient@@$$FQAE_NPADH_J@Z) referenced in function "public: bool __clrcall RCSClientWrapper::RCSclientWrapper::ResumeChannel(class System::String ^,int,class System::DateTime ^)" (?ResumeChannel@RCSclientWrapper@RCSClientWrapper@@$$FQ$AAM_NP$AAVString@System@@HP$AAVDateTime@4@@Z) RCSClientWrapper.obj RCSClientWrapper

Tried to add the user32.lib with no results..

Ofer

like image 779
ofer Avatar asked Apr 06 '09 13:04

ofer


1 Answers

C++/CLI allows you to mix in native C++ pretty much at will, but using C++/CLI makes your app depend on the .NET framework.

The reason is your C++/CLI project doesn't have some libs (user32.lib, in example) setup in the linker input is that the .NET framework already provides similar services, and the IDE assumes that you prefer those to the older, native ones.

Check your project and add reference to the corresponding library.

like image 128
Quan Mai Avatar answered Sep 24 '22 18:09

Quan Mai