• 5718阅读
  • 2回复

大家帮我看一下这是什么原因 [复制链接]

上一主题 下一主题
离线younglee
 
只看楼主 倒序阅读 楼主  发表于: 2006-04-16
程序是这样的:
#include<qapplication.h>
#include<stdio.h>
main(int argc, char **argv)
{
  printf("hello\n");
}
----------------
不包含#include<qapplication.h>可以正确编译,但是包含了之后,
编译后:


make
g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=\
0 -Wall -fPIC -DQT_NO_DEBUG -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/include -I/usr/lib/qt3/include -o test.o test.cpp
test.cpp:6: warning: ISO C++ forbids declaration of `main' with no type
test.cpp: In function `int main(int, char**)':
test.cpp:6: warning: unused parameter `int argc'
test.cpp:6: warning: unused parameter `char**argv'
g++ -o qt test.o   -L/usr/lib/ -L/usr/X11R6/lib/ -lXext -lX11 -lm
test.o(.gnu.linkonce.d._ZTV6QGList+0xc): undefined reference to `QGList::clear()'
test.o(.gnu.linkonce.d._ZTV6QGList+0x10): undefined reference to `QGList::~QGList [in-charge]()'
test.o(.gnu.linkonce.d._ZTV6QGList+0x14): undefined reference to `QGList::~QGList [in-charge deleting]()'
test.o(.gnu.linkonce.d._ZTV6QGList+0x18): undefined reference to `QPtrCollection::newItem(void*)'
test.o(.gnu.linkonce.d._ZTV6QGList+0x20): undefined reference to `QGList::compareItems(void*, void*)'
test.o(.gnu.linkonce.d._ZTV6QGList+0x24): undefined reference to `QGList::read(QDataStream&, void*&)'
test.o(.gnu.linkonce.d._ZTV6QGList+0x28): undefined reference to `QGList::write(QDataStream&, void*) const'
test.o(.gnu.linkonce.d._ZTI6QGList+0x8): undefined reference to `typeinfo for QPtrCollection'
test.o(.gnu.linkonce.d._ZTV15QDragEnterEvent+0x10): undefined reference to `QDropEvent::format(int) const'
test.o(.gnu.linkonce.d._ZTV15QDragEnterEvent+0x14): undefined reference to `QDropEvent::encodedData(char const*) const'
test.o(.gnu.linkonce.d._ZTV15QDragEnterEvent+0x18): undefined reference to `QDropEvent::provides(char const*) const'
......

这是什么问题啊
[ 此贴被XChinux在2006-04-16 23:00重新编辑 ]
离线alexzhao
只看该作者 1楼 发表于: 2006-04-17
老天,你去看看helloworld的程序再写吧
离线liu_ming50

只看该作者 2楼 发表于: 2006-07-03
在qt程序里使用 printf(x...)要如下包含头文件
extern "C"{
#include <stdio.h>
}
试一下吧,没道理会那样。
快速回复
限100 字节
 
上一个 下一个