本文介绍了添加外部“c” ro vc ++表单应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在c ++中有一个控制台应用程序可以运行,但是在VC ++表单应用程序中我得到以下错误,任何想法如何纠正它?
错误:
错误6错误LNK2028:未解析的令牌(0A000013)externCstruct HDC__ * __stdcall GetDC(struct HWND __)(?GetDC @@ $$ J14YGPAUHDC __ @@ PAUHWND __ @@@ Z )在函数private:void __clrcall sysinfo :: Form1 :: button1_Click(类System :: Object ^,类System :: EventArgs ^)中引用(?button1_Click @ Form1 @ sysinfo @@ $$ FA $ AAMXP $ AAVObject @ System @@ P $ AAVEventArgs @ 4 @@ Z)sysinfo.obj sysinfo
note我已经包含< windows.h>在项目的stdafx.h中
代码
私人:系统: :Void button1_Click(System :: Object ^ sender,System :: EventArgs ^ e){
double i,c,d,f,g,k;
char l;
HDC hdc = GetDC(GetDesktopWindow());
DWORD ret = GetDeviceCaps(hdc,HORZSIZE);
DWORD ret2 = GetDeviceCaps(hdc,VERTSIZE);
// std :: cout<< 你的屏幕尺寸以英寸为单位<< ret / 25.4<< \x<<< ret2 / 25.4<<\\ n;
ReleaseDC(GetDesktopWindow(),hdc);
我必须使用hdc等变量?
解决方案
Hi,
I have a console application in c++ that Works, but in VC++ forms application I get the following errors, any idea how to correct it?
error :
Error6error LNK2028: unresolved token (0A000013) "extern "C" struct HDC__ * __stdcall GetDC(struct HWND__ *)" (?GetDC@@$$J14YGPAUHDC__@@PAUHWND__@@@Z) referenced in function "private: void __clrcall sysinfo::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@sysinfo@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)sysinfo.objsysinfo
note I have included <windows.h> in stdafx.h of the project
code
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
double i,c,d,f,g,k;
char l;
HDC hdc = GetDC(GetDesktopWindow());
DWORD ret = GetDeviceCaps(hdc, HORZSIZE);
DWORD ret2 = GetDeviceCaps(hdc, VERTSIZE);
// std::cout << "Your screen size in inches is " << ret/25.4 << "\" x " << ret2/25.4 << "\" \n";
ReleaseDC(GetDesktopWindow(), hdc);
I have to use variables for hdc etc.?
解决方案
这篇关于添加外部“c” ro vc ++表单应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!