Total Articles 180
[gui_option_test.pro]
contains(QT, gui) {
message (gui)
} else {
message (no_gui)
}
TARGET = gui_option_test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
[main.cpp]
#ifdef QT_GUI_LIB#include <QApplication>#include <QMessageBox>#else
#include <QCoreApplication>#endif // QT_GUI_LIB#include <QDebug>int main(int argc, char *argv[]){#ifdef QT_GUI_LIBQApplication a(argc, argv);#elseQCoreApplication a(argc, argv);#endif // QT_GUI_LIBqDebug() << "bef messagebox";#ifdef QT_GUI_LIBQMessageBox::information(NULL, "title", "text");#endif // QT_GUI_LIBqDebug() << "aft messagebox";
return 0;}
[qmake_gui.bat]call _clear.bat qmake "QT+=gui"
[qmake_no_gui.bat]call _clear.bat qmake "QT-=gui"
[Download]
gui_option_test.zip