#include <iostream>
#include<QApplication>
using namespace std;
int main(int argc, char *argv[])
{
//cout << "Hello World!" << endl;
// return 0;
QApplication app(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
// 安裝QT自身翻譯檔案
QTranslator translatorQT;
{
QStringList environment = QProcess::systemEnvironment();
QString str;
bool bFinded = false;
foreach(str, environment)
{
if(str.startsWith("QTDIR="))
{
bFinded = true;
break;
}
}
if(bFinded)
{
str = str.mid(6);
bFinded = translatorQT.load("qt_" + QLocale::system().name(),str.append("/translations/"));
if(bFinded)
app.installTranslator(&translatorQT);
else
qDebug() <<QObject::tr("Can't find the translation file for Chinese!");
}
else
{
qDebug() << QObject::tr("Please set the environment variable QTDIR");
}
}
WGLWidget w;
w.show();
return app.exec();
}
C:\Users\Administrator.W7-201605101142\Personal\untitled2\main.cpp:2: error: QApplication: No such file or directory
uj5u.com熱心網友回復:
為什么提示沒有CApplication 檔案和目錄uj5u.com熱心網友回復:
QApplication 是Qt里的頭檔案,Qt5的一般在 $(QTDIR)\include\QtWidgets 里邊uj5u.com熱心網友回復:
你qt怎么配置的opencascadeuj5u.com熱心網友回復:
Qt5一般看看你的pro檔案,有木有qt += gui widgets
QApplication是widgets的東西。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/42428.html
標籤:Qt
上一篇:關于Qt中的ui_mainwindow.h檔案,為什么在h檔案中有“實作”,不應該只是宣告嗎?
下一篇:請教關于QT中記憶體釋放的問題
