[英]unresolved linker errors for many windows functions in Qt
在Qt中,许多Windows函数(例如SHGetKnownFolderPath
出现无法解决的链接器错误
#include "pip.h"
#include "ui_pip.h"
#include <QFileDialog>
#include <QMessageBox>
#include <Objbase.h>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <algorithm>
#include <QtNetwork/QHostAddress>
#include <shlobj.h>
#include <windows.h>
#include <Shlwapi.h>
#include <Knownfolders.h>
功能:
PWSTR appData = 0;
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Desktop,
0,
NULL,
&appData)))
{
wcout << appData << endl;
}
链接器错误:
pip.obj : error LNK2019: unresolved external symbol _SHGetKnownFolderPath@16
referenced in function "private: void __thiscall pip::on_submitButton_clicked(void)"
(?on_submitButton_clicked@pip@@AAEXXZ)
我需要告诉QT Shell32.dll
库在哪里还是shlobj.h
东西?
您必须将项目链接到实现该符号的库 ( shell32.lib )!
您应该在.PRO文件中添加以下内容:
LIBS += -L"C:\\Path\\Microsoft SDK\\Windows\\v7.1\\Lib" -lshell32
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.