读书人

无法解析的外部符号 _imp_SetCursorPo

发布时间: 2012-03-21 13:33:15 作者: rapoo

无法解析的外部符号 __imp__SetCursorPos
1>mouseController.obj : error LNK2019: 无法解析的外部符号 __imp__mouse_event@20,该符号在函数 _wmain 中被引用
1>mouseController.obj : error LNK2019: 无法解析的外部符号 __imp__SetCursorPos@8,该符号在函数 _wmain 中被引用
1>mouseController.obj : error LNK2019: 无法解析的外部符号 __imp__GetCursorPos@4,该符号在函数 _wmain 中被引用


C/C++ code
#include "stdafx.h"#include "CVObject.h"#include <Windows.h>#include <iostream>using namespace std;//get sign of number#define SIGN(n) (n==0?(n<0?-1:0):1)int _tmain(int argc, _TCHAR* argv[]){    int cameraIndex=0;    if (argc==2){        cameraIndex=argv[1][0]-'0';               }    ............if (lastGesture.type==FIST&&g.type==PALM){                        mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);                        cout<<"mouse left button up"<<endl;                    }else if (lastGesture.type==PALM&&g.type==FIST){                        mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);                        cout<<"mouse left button down"<<endl;............                    if(!SetCursorPos(ptDst.x,ptDst.y)){                        cout<<"failed to set position of cursor"<<endl;                        break;                    }............


一个手势识别程序,之前我用VC 6 + OpenCV 2.2.0的时候编译通过了。
现在是用VS2010 + OpenCV 2.3.1来编译,出现了上面的错误。麻烦各位看下是不是还需要包含什么,先谢谢了。


[解决办法]
把kernel32.lib添加到工程中。
[解决办法]
LS正解,楼主没有添加这个所以编译器找不到函数的申明。
[解决办法]
加user32.lib
[解决办法]
头文件后面加一行
#progma comment(lib,"kernel32.lib")

读书人网 >C++

热点推荐