• 5266阅读
  • 8回复

hello qt的问题 [复制链接]

上一主题 下一主题
离线zxwind
 

只看楼主 倒序阅读 楼主  发表于: 2009-03-25
我按照c++ gui programing with qt4上的第一个例子写了hello qt,但是在最后make hellp的时候报错

g++     hello.cpp   -o hello
hello.cpp:1:23: QApplication: No such file or directory
hello.cpp:2:17: QLabel: No such file or directory
hello.cpp: In function `int main(int, char**)':
hello.cpp:6: error: `QApplication' was not declared in this scope
hello.cpp:6: error: expected `;' before "app"
hello.cpp:7: error: `QLabel' was not declared in this scope
hello.cpp:7: error: `label' was not declared in this scope
hello.cpp:7: error: `QLabel' is not a type
hello.cpp:9: error: `app' was not declared in this scope
hello.cpp:10:2: warning: no newline at end of file

qt4.5,windows下用qmake编译的。自动生成的hello.pro里的内容是这样的:
######################################################################
# Automatically generated by qmake (2.01a) ??? ?? 25 21:04:21 2009
######################################################################

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

# Input
SOURCES += hello.cpp
离线langzi123

只看该作者 1楼 发表于: 2009-03-25
楼上的应该没有配置路径,找不到文件
离线zxwind

只看该作者 2楼 发表于: 2009-03-25
但是我查了一下,include的路径好像不用配置啊
离线sunwj
只看该作者 3楼 发表于: 2009-03-25
使用集成环境吧
只看该作者 4楼 发表于: 2009-03-26
qmake之后别加参数运行下
然后运行make
离线firetree
只看该作者 5楼 发表于: 2009-03-27
检查一下环境变量的设置
离线tiancaiamao

只看该作者 6楼 发表于: 2009-03-28
Qt的开发环境还没建好...
离线bingoking
只看该作者 7楼 发表于: 2009-03-28
环境变量没设置
离线clintonlow
只看该作者 8楼 发表于: 2009-03-29
是不是左邊Src目錄裡面.pro的檔案~~內容qt-=gui沒刪掉呀
我一開始照別本書打或是從網路上複製貼上編譯都不會過~~自從把這行刪掉之後~~雨過天晴!
快速回复
限100 字节
 
上一个 下一个