• 6181阅读
  • 9回复

qt编译问题 [复制链接]

上一主题 下一主题
离线zhaoli
 
只看楼主 倒序阅读 楼主  发表于: 2008-03-27
— 本帖被 XChinux 执行加亮操作(2008-03-29) —
我 刚开始学 qt,在编译过程中出现下面的问题,代码应该是没有错误的 ,却不知是哪里出错,请高手指点一下,十分感激。

g++  -o test form_main.o moc_form_main.o  -L/usr/lib/qt-3.3/lib -lqt-mt -lXext -lX11 -lm
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld 返回 1
make: *** [test] 错误 1
努力学会qt
离线zhaoli
只看该作者 1楼 发表于: 2008-03-27
    请高手帮忙解答  谢谢
努力学会qt
离线captain08
只看该作者 2楼 发表于: 2008-03-28
先检查一下代码拼写有没有错误。用记事本写程序,这方面容易引起莫名其妙的错误。
离线zncggaofei
只看该作者 3楼 发表于: 2008-03-28
http://www.linuxfans.org/bbs/thread-35044-1-1.html

#include <stdio.h>
int main(int argc, char** argv)
{
        printf("hello\n");
        return 0;
}
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线zhaoli
只看该作者 4楼 发表于: 2008-03-28
谢谢2楼.只是我用的是qt3,那个代码是qt designer 构建界面后自动生成的,不会有错的啊.
努力学会qt
离线zncggaofei
只看该作者 5楼 发表于: 2008-03-28
那检查一下你的编译环境
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线zhaoli
只看该作者 6楼 发表于: 2008-03-28
谢谢zncggaofei,我的编译中的问题和他的一样,可是难道只是因为要加一行空格?我去试一下.
努力学会qt
离线zhaoli
只看该作者 7楼 发表于: 2008-03-28
编译环境?
努力学会qt
离线zncggaofei
只看该作者 8楼 发表于: 2008-03-28
这个问题可以在百度里查 这个  undefined reference to `main'    有很多
要是解决了说一声 !!!!
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线wd007

只看该作者 9楼 发表于: 2008-12-13
这句话的意思是,你声明了main(),但却没有定义它。
所以你要给出main()的定义,也就是实现。
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
快速回复
限100 字节
 
上一个 下一个