When i try to use GetMousePosition() in my code, i got bellowing link error when compiling in VS2010.
Is there any library i can include to resolve it?
error LNK2019: unresolved external symbol __imp__GetCursorPos@4 referenced in function "struct tagPOINT __cdecl GetMousePosition(void)" (?GetMousePosition@@YA?AUtagPOINT@@XZ)
Thanks,
Aidy
Yes, i searched it in the SDK sample BasicDragDrop as well. But i cannot fingure out why it works in SDK sample but not my CS6 project. The same code works well from CS3 to CS5.5.
I guess it is related to project setting or some special linking files (e.g. .cpp or .lib), however, nothing special can be found in SDK sample BasicDragDrop. ![]()
WSystemUtils.h includes the definition of GetMousePosition().
inline SysPoint GetMousePosition()
{
// ----- Returns mouse position in screen/global coordinates
SysPoint pt;
::GetCursorPos( &pt );
return pt;
}
The error means it needs the implement of GetCursorPos() which is invoked by GetMousePosition().
Steps to reproduce the problem:
1. New an empty project with name "test" using DollyXs on Windows;
2. In testActionComponent.cpp, modify DoAbout() to be
void testActionComponent::DoAbout()
{
GetMousePosition();
}
3. Build the project.
Then, we will get bellowing link error
1> Creating library ..\..\..\build\win\objD\test/test.lib and object ..\..\..\build\win\objD\test/test.exp
1>testActionComponent.obj : error LNK2019: unresolved external symbol __imp__GetCursorPos@4 referenced in function "private: void __thiscall testActionComponent::DoAbout(void)" (?DoAbout@testActionComponent@@AAEXXZ)
1>..\debug_cs6\test.sdk.pln : fatal error LNK1120: 1 unresolved externals
There is no such link error in the sdk sample BasicDragDrop.sdk.vcxproj, but i cannot find any special setting in its project property.
Any suggestion will be appreciated.
Thanks,
Aidy
North America
Europe, Middle East and Africa
Asia Pacific