[英]Implementing extern WINAPI call in MFC C++ App
I am working with Windows Form App C++ . 我正在使用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 我必须在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
错误1错误LNK2028:无法解析的令牌(0A000025)“外部” C“长__stdcall APPStartUp(未签名长,结构_version *)”(?WFSStartUp @@ $$ J18YGJKPAU_wfsversion @@@@ Z)在函数“私有:void __clrcall MyAppPresenter:中引用: :Form1 :: Form1_Load(类系统:: Object ^,类系统:: 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. 我认为这与MSVS2010 C ++控制台代码有关,移植到MSVS2010 C ++ GUI失败。 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 我检查了控制台C ++项目,发现* .vsxproj具有
<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. 因此,我只是将此代码手动添加到Windows Form C ++项目文件中,现在可以使用了。
Anyway I have no clue how to add it using GUI of VS 2010. 无论如何,我不知道如何使用VS 2010的GUI添加它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.