犯错误:C++ 中缺少包含内容脚本?
几分钟前我刚刚得到了如何编译这个脚本的帮助,但我已经成功地得到了错误。我只是 C++ 的初学者,不知道以下错误的含义或如何修复它。
这是有问题的脚本。我已经阅读了一些用户的评论,建议他们更改了 #include
部分,但这似乎正是脚本所具有的内容,查看此评论。
[root@localhost wkthumb]# qmake-qt4 && make
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -I. -o main.o main.cpp
main.cpp:5:20: error: QWebView: No such file or directory
main.cpp:6:21: error: QWebFrame: No such file or directory
main.cpp:8: error: expected constructor, destructor, or type conversion before ‘*’ token
main.cpp:11: error: ‘QWebView’ has not been declared
main.cpp: In function ‘void loadFinished(bool)’:
main.cpp:18: error: ‘view’ was not declared in this scope
main.cpp:18: error: ‘QWebSettings’ has not been declared
main.cpp:19: error: ‘QWebSettings’ has not been declared
main.cpp:20: error: ‘QWebSettings’ has not been declared
main.cpp: In function ‘int main(int, char**)’:
main.cpp:42: error: ‘view’ was not declared in this scope
main.cpp:42: error: expected type-specifier before ‘QWebView’
main.cpp:42: error: expected `;' before ‘QWebView’
make: *** [main.o] Error 1
我的 Fedora Core 10 机器上有该 Web 工具包: qt-4.5.3-9.fc10.i386 qt-devel-4.5.3-9.fc10.i386
感谢大家的帮助
I just got help in how to compile this script a few mintues ago on SO but I have managed to get errors. I am only a beginner in C++ and have no idea what the below erros means or how to fix it.
This is the script in question. I have read the comments from some users suggesting they changed the #include
parts but it seems to be exactly what the script has, see this comment.
[root@localhost wkthumb]# qmake-qt4 && make
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -I. -o main.o main.cpp
main.cpp:5:20: error: QWebView: No such file or directory
main.cpp:6:21: error: QWebFrame: No such file or directory
main.cpp:8: error: expected constructor, destructor, or type conversion before ‘*’ token
main.cpp:11: error: ‘QWebView’ has not been declared
main.cpp: In function ‘void loadFinished(bool)’:
main.cpp:18: error: ‘view’ was not declared in this scope
main.cpp:18: error: ‘QWebSettings’ has not been declared
main.cpp:19: error: ‘QWebSettings’ has not been declared
main.cpp:20: error: ‘QWebSettings’ has not been declared
main.cpp: In function ‘int main(int, char**)’:
main.cpp:42: error: ‘view’ was not declared in this scope
main.cpp:42: error: expected type-specifier before ‘QWebView’
main.cpp:42: error: expected `;' before ‘QWebView’
make: *** [main.o] Error 1
I have the web kit on my Fedora Core 10 machine:
qt-4.5.3-9.fc10.i386
qt-devel-4.5.3-9.fc10.i386
Thanks all for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该错误消息表明编译器找不到您尝试包含的内容,即
。告诉编译器去哪里查找的方法是使用-I
标志来指定包含目录(这些目录不是递归的)。目前,您设置以下包含目录:
您需要找到
QWebView
在系统上的位置,并将包含路径添加到命令行(或将 QWebView 安装到上述目录之一)。一般注意事项:当您遇到很多这样的错误时,请重点关注前一两个错误。后面的错误(例如
“QWebView”尚未声明
)可能会通过修复丢失包含错误来解决。The error message indicates that the compiler cannot find what you're trying to include, i.e.
<QWebView>
. The way to tell the compiler where to look is with the-I
flag, to specify include directories (these are not recursive).Currently, you set the following include dirs:
You need to find where
QWebView
is located on your system, and add the include path to the commandline (or install QWebView into one of the above dirs).General note: When you get a lot of errors like this, focus on the first one or two. The later errors (such as
‘QWebView’ has not been declared
) will probably be solved by fixing the missing-include error.看起来必须在代码中提供名称空间。阅读命名空间。
没有可用的类型定义,可能会缺少包含。
Looks like namespaces have to be provided in the code. Read on namespaces.
No type definition available, can be missing include.