• 5276阅读
  • 5回复

编译通不过 [复制链接]

上一主题 下一主题
离线style
 
只看楼主 倒序阅读 楼主  发表于: 2006-09-11
#include <QtGui>
#include <QtNetwork\QHttp>

int main(int argc, char **argv)
{
  QApplication app(argc, argv);
  QUrl url("http://au.9you.com/download/regedit_98.reg");
  QFile file("reg");
  file.open(QIODevice::WriteOnly);
  QHttp http;
  http.setHost(url.host(), 80);
  http.get(url.path(), &file);
  QObject::connect( &http, SIGNAL(requestFinished(int, bool)), qApp, SLOT( quit()) );
  int a = app.exec();
  return a;
}

//我知道程序中有小缺点。比如file没有close().之类的。先不谈这个。我只是想测试一下http基本现实下载文件。

//可是问题是上面代码怎么也编译不通过。。。     提示的信息也看不懂。帮助下。谢谢
[ 此贴被XChinux在2006-09-11 08:47重新编辑 ]
离线XChinux

只看该作者 1楼 发表于: 2006-09-11
把编译信息帖出来啊
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线style
只看该作者 2楼 发表于: 2006-09-11
E:\win>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `E:/win'
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runt
ime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows -o "release\win.exe" relea
se\man.o -L"d:\Qt\lib" -lmingw32 -lqtmain -lQtGui4 -lQtCore4
release\man.o(.text+0x247):man.cpp: undefined reference to `_imp___ZN5QHttpC1EP7
QObject'
release\man.o(.text+0x289):man.cpp: undefined reference to `_imp___ZN5QHttp7setH
ostERK7QStringt'
release\man.o(.text+0x2fe):man.cpp: undefined reference to `_imp___ZN5QHttp3getE
RK7QStringP9QIODevice'
release\man.o(.text+0x3a3):man.cpp: undefined reference to `QHttp::~QHttp()'
release\man.o(.text+0x4a2):man.cpp: undefined reference to `QHttp::~QHttp()'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\win.exe] Error 1
mingw32-make[1]: Leaving directory `E:/win'
mingw32-make: *** [release] Error 2
离线style
只看该作者 3楼 发表于: 2006-09-11
顶 s
离线XChinux

只看该作者 4楼 发表于: 2006-09-11
在你的 .pro文件里加上:
QT += network
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线style
只看该作者 5楼 发表于: 2006-09-11
谢谢。果然一加就好了。。。

这样的知识在哪里学到的?
快速回复
限100 字节
 
上一个 下一个