mainwindow.obj:-1: error: LNK2019: 無法決議的外部符號 __imp__ScreenToClient@8,該符號在函式 "public: __thiscall MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QAE@PAVQWidget@@@Z) 中被參考
#include <qt_windows.h>
#include <cstdio>
QRect rect;
HWND hwnd = (HWND)this->winId();
rect = frameGeometry();
qDebug()<<rect<<rect.x()<<rect.y()<<rect.left()<<rect.top()<<rect.right()<<rect.bottom()<<rect.width()<<rect.height();
tagPOINT point{rect.x(),rect.y()};
ScreenToClient(hwnd,&point);
qDebug()<<&point;
使用ScreenToClient函式的時候提示無法決議,但是windouw.h已經include的了,為什么還會這樣呢,是有哪個庫沒有參考嗎
uj5u.com熱心網友回復:
缺少庫,類外添加#pragma comment(lib,"User32.lib")或者在pro檔案鏈接User32.lib庫轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/268562.html
標籤:Qt
