::clock 尚未声明

::clock has not been declared

我正在尝试使用 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;
           ^~~~~~~~

可能为时已晚,无法帮助原始发布者,但基于 other ,您的源代码中可能有一个名为 time.h 的文件。将文件重命名(并调整包含它的代码)为 time_utils. 之类的其他名称,它应该可以编译。