#include <QApplication.h>
#include <QLabel>
int main( int argc, char **argv )
{
QApplication app( argc, argv );
//QLabel *label = new QLabel("Hello Qt!");
QLabel *label=new QLabel("<h2><i>Hello</i>"
"<font color=red>Qt!</font></h2>");
label->show();
return app.exec();
#include <QLabel>
int main( int argc, char **argv )
{
QApplication app( argc, argv );
//QLabel *label = new QLabel("Hello Qt!");
QLabel *label=new QLabel("<h2><i>Hello</i>"
"<font color=red>Qt!</font></h2>");
label->show();
return app.exec();
}
很简单的一个hello Qt 但是遇到了一些问题
1.命令行,开始在cmd下直接搞,不行;后来在开始菜单-Qt4.8.3下用其命令行才行;
2.生成的pro文件直接拖到Qt creator 下不能用,启动报错:QT调试:没有CDB二进制档可用为二进制格式,网搜一篇解决方案http://pppboy.blog.163.com/blog/static/30203796201242083014944/
后来在Qt5的开始菜单里找到了MinGW的命令行,用这个又生成一遍才能在Qt creator 下运行该程序
3一些语法上的错误:
另外这次程序,我在vs,qt creator 以及Qt命令行下,debug下都跑通了:关键点都在这里了: