环境配置相关文章:
转自:
https://blog.csdn.net/zusi_csdn/article/details/80085943
基于QT 5.10.1环境配置:
C:\Qt\Qt5.10.1\5.10.1\mingw53_32\bin;
C:\Qt\Qt5.10.1\Tools\mingw530_32\bin;
通过命令行的方式编译QT源程序
- 启动 QT 命令行
- 进入源程序所在目录
- 命令:
- qmake -project //根据目录中的源码生成工程文件
- qmake hello_qt.pro //根据工程文件生成makefile文件
- mingw32-make //根据makefile进行编译
QT4.7.4相关源码测试代码
#include <QApplication>
#include <QMainWindow>
#include <QPushButton>
int main(int argc, char* argv[])
{
QApplication a(argc,argv);
QMainWindow w;
QPushButton b(&w);
b.setText("hello QT...");
w.show();
return a.exec();
}
QT 5.10.1 for Desktop(MinGW 5.3.0.32 bit)编译报错问题:
D:\qt_test\lesson4>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory ‘D:/qt_test/’
g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I. -IC:\Qt\Qt5.10.1\5.10.1\mingw53_32\include -IC:\Qt\Qt5.10.1\5.10.1\mingw53_32\include\QtGui -IC:\Qt\Qt5.10.1\5.10.1\mingw53_32\include\QtANGLE -IC:\Qt\Qt5.10.1\5.10.1\mingw53_32\include\QtCore -Irelease -IC:\Qt\Qt5.10.1\5.10.1\mingw53_32\mkspecs\win32-g++ -o release\HelloQt.o HelloQt.cpp
HelloQt.cpp:1:24: fatal error: QApplication: No such file or directory
compilation terminated.
Makefile.Release:118: recipe for target ‘release/HelloQt.o’ failed
mingw32-make[1]: *** [release/HelloQt.o] Error 1
mingw32-make[1]: Leaving directory ‘D:/qt_test/lesson4’
Makefile:36: recipe for target ‘release’ failed
mingw32-make: *** [release] Error 2
fatal error: QApplication: No such file or directory编译报错问题解决:
转自:
https://blog.csdn.net/friendbkf/article/details/45440175
可编译代码:
#include <QtWidgets/QApplication>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QMainWindow>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPushButton pushButton(QObject::tr("hello QT!"));
pushButton.show();
return a.exec();
}

979

被折叠的 条评论
为什么被折叠?



