【发布时间】:2010-09-09 16:16:45
【问题描述】:
我在 Visual C++ 2008 中使用 Windows 窗体创建了一个简单的 GUI。GUI 中有一个按钮。按下按钮时,我希望鼠标光标指向坐标(0,900)。我创建了单独的头文件和 c++ 源文件,将光标位置设置为指定位置 (x,y)。为此,我使用了 Win32 的 SetCursorPos() 函数。我在单独的文件中编写了用于设置光标位置的代码,因为我只希望使用 .NET 构建 GUI。对于其他功能,我想使用本机 C++ 和 Win32 库。
在构建代码时,我在链接时收到以下错误消息:
1>SimpleForms.obj : error LNK2028: unresolved token (0A00000F) "extern "C" int __stdcall SetCursorPos(int,int)" (?SetCursorPos@@$$J18YGHHH@Z) referenced in function "private: void __clrcall SimpleForms::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@SimpleForms@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>SimpleForms.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall SetCursorPos(int,int)" (?SetCursorPos@@$$J18YGHHH@Z) referenced in function "private: void __clrcall SimpleForms::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@SimpleForms@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
【问题讨论】:
标签: .net visual-c++ visual-studio-2008 c++-cli name-decoration