[英]How to build Qt for Windows?
我試圖讓 Qt 為 Windows 工作。 我從: https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_source_code開始。
我可以克隆 Git 存儲庫,但沒有任何效果:
..\\qt5\configure -developer-build -opensource -nomake examples -nomake tests
它給我帶來了找不到命令的錯誤:
+ CategoryInfo : ObjectNotFound: (../qt5/configure:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
文件 configure 和 configure.bat 存在於正確的位置...運行 nmake 會導致缺少 makefile 的錯誤...
我沒有看到有二進制文件,我安裝了它。 現在,在 QtCreator 中,我遇到了另一個問題。 我嘗試添加一個新的空項目,當我必須輸入一個工具包時,我得到了這個:捕獲:
我必須做什么? 我不能 select 任何人。
重新安裝 Qt 后,我可以找到套件,但是當我編譯一個簡單的程序時:
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
return app.exec();
}
我收到了這個錯誤:
MSVCRTD.lib(exe_winmain.obj):-1: error: LNK2019: unresolved external symbol WinMain r‚f‚renc‚ in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
最后將 CONFIG += console 添加到 .pro 文件解決了這個問題。
以下是我用來在 Windows 下編譯 Qt5 的命令(當然,您需要更新路徑和選項以適應您的情況):
cd C:\Qt\qt-everywhere-opensource-src-5.xx.y
configure -prefix %CD%\qtbase -opensource -nomake tests -nomake examples
nmake
(在 Qt 的最新版本上,例如 5.15.4,您可以調用 jom 而不是 nmake 以獲得更快的編譯)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.