• 8946阅读
  • 2回复

[已解决]错误:Qstring: 没有那个文件或目录 [复制链接]

上一主题 下一主题
离线blueliang
 
只看楼主 倒序阅读 楼主  发表于: 2008-11-26
— 本帖被 XChinux 执行加亮操作(2008-11-30) —
环境:red flag linux 6.0 SP1,QT 4.4.3

源代码 :#include <Qstring>
#include <qfile.h>
#include <iostream>

using namespace std;

int main(int argc,char *argv[])
{
Qstring str1;
Qstring str2;
cout<<"please input a file pathname:";
cin>>str1;
cout<<"please input a file new pathname:";
cin>>str2;
QFile file;
file.copy(str1,str2);
return 0;
}

运行时报错:
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.4.3/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.4.3/include/QtCore -I/usr/local/Trolltech/Qt-4.4.3/include/QtCore -I/usr/local/Trolltech/Qt-4.4.3/include/QtGui -I/usr/local/Trolltech/Qt-4.4.3/include/QtGui -I/usr/local/Trolltech/Qt-4.4.3/include -I. -I. -I. -o copy.o copy.cpp
copy.cpp:1:19: error: Qstring: 没有那个文件或目录
copy.cpp: In function ‘int main(int, char**)’:
copy.cpp:9: error: ‘Qstring’ was not declared in this scope
copy.cpp:9: error: expected `;' before ‘str1’
copy.cpp:10: error: expected `;' before ‘str2’
copy.cpp:12: error: ‘str1’ was not declared in this scope
copy.cpp:14: error: ‘str2’ was not declared in this scope
copy.cpp: At global scope:
copy.cpp:7: warning: unused parameter ‘argc’
copy.cpp:7: warning: unused parameter ‘argv’
make: *** [copy.o] 错误 1

Qstring是QT4下面库呀,怎么会找不到,请问应该怎么样解决!
[ 此贴被blueliang在2008-12-15 10:59重新编辑 ]
离线blueliang
只看该作者 1楼 发表于: 2008-11-26
自己找到了答案,应该是#include <qstring>
http://doc.trolltech.com/4.2/qstring.html  QT网站上的那个是错误的。
离线water_wf

只看该作者 2楼 发表于: 2008-11-26
lz必定用的linux系统
快速回复
限100 字节
 
上一个 下一个