::clock 未声明

6
我正在尝试使用Qt Creator构建一个小型的Qt项目。 我将此驱动程序添加到我的项目中:https://github.com/cisco-open-source/qtwebdriver 我包含了它的库, 当我试图构建时,我会得到以下错误:
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设置有问题,但是无法确定具体是什么问题... - sklott
1个回答

8

可能已经为原始发布者太晚了,但基于其他答案(herehere),您的源代码中可能有一个名为time.h的文件。 将该文件重命名(并调整包含它的代码)为time_utils.h或其他名称,然后就可以编译了。


1
确实解决了我的问题,忘记在这里添加了。谢谢! - Ofir

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接