QtCreator 用纯代码编写应用程序与命令行编译
2014-07-14 16:40
218 查看
添加空程序添加C++ source file: main.cpp #include <QApplication>
#include <QDialog>
#include <QLabel>
int main(int argc, char** argv) {
QApplication app(argc,argv);
QDialog w;
QLabel lbl(&w);
lbl.setText("hello,你好!");
w.show();
return app.exec();
}需要界面的QT程序都必须要在,*.pro文件里面加下面的语句QT += core guigreaterThan(QT_MAJOR_VERSION, 4): QT += widgets避免中文出现乱码
#include <QApplication>
#include <QDialog>
#include <QLabel>
#include <QTextCodec>
int main(int argc, char** argv) {
QApplication app(argc,argv);
QTextCodec::setCodecForLocale(QTextCodec::codecForLocale());
QDialog w;
QLabel lbl(&w);
lbl.setText(QObject::tr("你好!"));
w.show();
return app.exec();
}qmake -projectqmakemake
相关文章推荐
- 在QtCreator中纯代码编写程序编译无法通过
- 在命令行中编译.NET代码
- Microsoft .NET Framework SDK Net Classes:用管理代码编写联网应用程序
- C#编写不安全代码 和应用程序域
- 命令行开发、编译、打包Android应用程序
- 【Step by Step】编写代码验证一个ASP.NET应用程序和页面的生命周期
- Microsoft .NET Framework SDK Net Classes:用管理代码编写联网应用程序
- 命令行方式创建和编译android应用程序
- 使用GTK+ 编写的代码,在编译时使用 gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0`
- 【iOS-cocos2d-X 游戏开发之七】整合Cocos2dX的Android项目到Xcode项目中,Xcode编写&编译代码,Android导入打包运行即可!
- asp.net 2.0教程 应用程序的编写、编译及发布
- 如何编写程序使得数据库服务器变化时代码不需要重新编译
- 怎么把编译好的代码制成EXE应用程序?
- 编译链接正常,但是应用程序未运行到自己的代码就莫名奇妙崩溃!
- .net的命令行编译代码!
- asp.net 2.0教程 应用程序的编写、编译及发布
- 命令行编译android程序,欢迎探讨命令行如何使用proguard混淆优化代码
- 在c#编写的软件中动态地编译新的代码
- Mac下命令行编译objective-c代码
- 命令行开发、编译、打包Android应用程序