在MFC C ++应用程序中实现extern WINAPI调用 [英] Implementing extern WINAPI call in MFC C++ App

查看:620
本文介绍了在MFC C ++应用程序中实现extern WINAPI调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Windows Form App C ++
我必须使用一些有

 的头文件HRESULT extern WINAPI StartUp(DWORD dwVRequired,LPVERSION lpVersion); 

我必须在 Form1.h

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

但我得到这样的编译错误




错误1错误LNK2028:未解析的令牌(0A000025)externClong
__stdcall APPStartUp(unsigned long,struct _version *) @ $$ J18YGJKPAU_wfsversion @@@ Z)在函数
中引用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


我假设它与
有关将MSVS2010 C ++控制台代码移植到MSVS2010 C ++ GUI失败。为什么?



但是怎么做呢?
任何线索如何修复?

解决方案

我检查了控制台C ++项目,发现 .vsxproj

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

所以我只是手动添加这个代码到Windows Form C ++项目文件,现在它工作。 p>

无论如何,我不知道如何使用VS 2010的GUI添加它。


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?

解决方案

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.

这篇关于在MFC C ++应用程序中实现extern WINAPI调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆