JCHub

  • Home
  • Category
    • A/V
    • WebRTC
    • Beauty of Programming
    • Linux
    • Windows
    • Moments of Life
    • Campus Life
  • Reference
    • API Reference
    • Utilities
    • AV Test
    • Doc
  • Message Board
  • About
JCHub
Code as My Sword, Lost in Obsession
  1. Main page
  2. Beauty of Programming
  3. Main content

Qt5学习-错误总结

2013年11月27日 1202hotness 0likes 0comments

最近在学Qt5,遇到了许多问题,这篇文章主要对自己遇到的一些问题进行总结。
1.编译最简单的HelloWorld时

C++
1
2
3
4
5
6
7
8
9
10
11
#include<QApplication>
#include<QPushButton>
 
int main(int argc,char *argv[])
{
    QApplication a(argc,argv);
    QPushButton b("hello world",0);
    b.resize(200,200);
    b.show();
    return a.exec();
}

系统提示:QApplication: no such file or directory
解决方法:这是因为Qt5的qapplication在QtWidgets模块里,和Qt4不一样,Qt4的qapplication在QtGui模块里,在pro里添加一行

1
QT += core gui widgets

即可。

This article is licensed with Creative Commons Attribution-NonCommercial-No Derivatives 4.0 International License
Tag: C++ Qt
Last updated:2013年12月8日

Jeff

管理员——代码为剑,如痴如醉

Tip the author Like
< Last article
Next article >

Comments

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
Cancel

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts
  • Qt中的Webkit
  • Nodejs C++ addon开发简介
  • 网络字节转换到本地字节的函数模板
  • MFC自绘带背景颜色标题栏
  • VC++获取本机IP地址
Categories

COPYRIGHT © 2026 jianchihu.net. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang