::clock 尚未声明
Posted
技术标签:
【中文标题】::clock 尚未声明【英文标题】:::clock has not been declared 【发布时间】:2019-09-24 07:54:12 【问题描述】:我正在尝试使用 Qt Creator 构建一个小 qt 项目。 我将此驱动程序添加到我的项目中:https://github.com/cisco-open-source/qtwebdriver
i 包括它的库,
当我尝试构建时,我得到了这个:
g++ -c -pipe -g -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../OfirWebDriverProj -I. -I../ofir/qtwebdriver/out/dist/desktop/release/libs -I../ofir/qtwebdriver/out/dist/desktop/release/libs -I../ofir/qtwebdriver/out/dist/desktop/release/libs -I../ofir/qtwebdriver/out/dist/desktop/release/libs -I../ofir/qtwebdriver/out/desktop/release/Default/lib.target -I../ofir/qtwebdriver/out/desktop/release/Default/lib.target -I../ofir/qtwebdriver/out/desktop/release/Default/lib.target -I../ofir/qtwebdriver/out/desktop/release/Default/lib.target -I../ofir/qtwebdriver/out/dist/desktop/release/h/base -I../ofir/qtwebdriver/out/dist/desktop/release/h -I../ofir/qtwebdriver/out/dist/desktop/release/Test -I/opt/Qt5.9.1/5.9.1/gcc_64/include -I/opt/Qt5.9.1/5.9.1/gcc_64/include/QtWidgets -I/opt/Qt5.9.1/5.9.1/gcc_64/include/QtGui -I/opt/Qt5.9.1/5.9.1/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I/opt/Qt5.9.1/5.9.1/gcc_64/mkspecs/linux-g++ -o main.o ../OfirWebDriverProj/main.cpp
In file included from /usr/include/c++/7/chrono:41:0,
from /opt/Qt5.9.1/5.9.1/gcc_64/include/QtCore/qobject.h:59,
from /opt/Qt5.9.1/5.9.1/gcc_64/include/QtCore/qcoreapplication.h:46,
from /opt/Qt5.9.1/5.9.1/gcc_64/include/QtWidgets/qapplication.h:44,
from /opt/Qt5.9.1/5.9.1/gcc_64/include/QtWidgets/QApplication:1,
from ../OfirWebDriverProj/main.cpp:2:
/usr/include/c++/7/ctime:64:11: error: ‘::clock’ has not been declared
using ::clock;
^~~~~
/usr/include/c++/7/ctime:65:11: error: ‘::difftime’ has not been declared
using ::difftime;
^~~~~~~~
/usr/include/c++/7/ctime:66:11: error: ‘::mktime’ has not been declared
using ::mktime;
^~~~~~
/usr/include/c++/7/ctime:67:11: error: ‘::time’ has not been declared
using ::time;
^~~~
/usr/include/c++/7/ctime:68:11: error: ‘::asctime’ has not been declared
using ::asctime;
^~~~~~~
/usr/include/c++/7/ctime:69:11: error: ‘::ctime’ has not been declared
using ::ctime;
^~~~~
/usr/include/c++/7/ctime:70:11: error: ‘::gmtime’ has not been declared
using ::gmtime;
^~~~~~
/usr/include/c++/7/ctime:71:11: error: ‘::localtime’ has not been declared
using ::localtime;
^~~~~~~~~
/usr/include/c++/7/ctime:72:11: error: ‘::strftime’ has not been declared
using ::strftime;
^~~~~~~~
【问题讨论】:
看起来你的 GCC 设置有问题,但不知道是什么... 【参考方案1】:可能为时已晚,无法帮助原始发布者,但基于 other answers,您的源中可能有一个名为 time.h
的文件。将文件重命名(并调整包含它的代码)为 time_utils.
之类的其他名称,它应该可以编译。
【讨论】:
确实解决了我的问题,忘记在这里添加了。谢谢!以上是关于::clock 尚未声明的主要内容,如果未能解决你的问题,请参考以下文章
QtCreator 编译失败:'qt_plugin_instance_Find' 尚未声明