1

I am working with Windows Form App C++. I have to use some header file that has

HRESULT extern WINAPI StartUp ( DWORD dwVRequired, LPVERSION lpVersion);

I have to execute this method within Form1.h

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
    APPVERSION version;
    HRESULT result = APPStartUp(APP_VERSIONS, &version);
}

But I am getting the compile error like this

Error 1 error LNK2028: unresolved token (0A000025) "extern "C" long __stdcall APPStartUp(unsigned long,struct _version *)" (?WFSStartUp@@$$J18YGJKPAU_wfsversion@@@Z) referenced in function "private: void __clrcall MyAppPresenter::Form1::Form1_Load(class System::Object ^,class System::EventArgs ^)" (?Form1_Load@Form1@MyAppPresenter@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) C:\Projects\MyAppPresenter\MyAppPresenter\MyAppPresenter.obj MyAppPresenter

I assume it has something to do with MSVS2010 C++ Console Code Ported to MSVS2010 C++ GUI is Failing. Why?

But how it can be done? Any clue how it could be fixed?

Community
  • 1
  • 1
NoWar
  • 36,338
  • 80
  • 323
  • 498
  • 1
    You need to link with library (`.lib` file) where unresolved function is implemented. – dewaffled Nov 11 '15 at 16:29
  • 1
    Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – dewaffled Nov 11 '15 at 16:29

1 Answers1

0

I checked the console C++ project and found that *.vsxproj has

<ItemGroup>
    <Library Include="C:\Program Files\Common Files\GCFApp\lib\msmanager.lib" />
</ItemGroup>

So I just added this code to the Windows Form C++ project file manually and now it works.

Anyway I have no clue how to add it using GUI of VS 2010.

NoWar
  • 36,338
  • 80
  • 323
  • 498