PDA

View Full Version : "error: 'clock_gettime' was not declared in this scope" and "error: 'CLOCK_MONOTONIC"



brunialti
27th January 2013, 16:10
Usung qt 4.8.1 unde windows. compiling "pure" c++ code i get the following errors:


trigwiz.h:149: error: 'CLOCK_MONOTONIC' was not declared in this scope
trigwiz.h:149: error: 'clock_gettime' was not declared in this scope

I know clock_gettime is in rt library and so i modified the .pro file as following:


TEMPLATE = app
CONFIG += console
CONFIG -= qt

SOURCES += main.cpp \
trigwiz.cpp

HEADERS += \
trigwiz.h

LIBS += -lpthread -lrt

unfortunately it was unsuccessfull...

amleto
27th January 2013, 20:47
you have a compiler error. so address the c++ compiler error. This has nothing to do with Qt.

http://linux.die.net/man/3/clock_gettime

brunialti
27th January 2013, 21:15
It has to do with the windows qt environment and the way it spread the file in the filesystem....
How can I check wether the lib is correctly reachable (presence/lib path) by the linker?
Moreover the time.h include should contain the CLOCK_MONOTONIC define. Where can I find it ?



you have a compiler error. so address the c++ compiler error. This has nothing to do with Qt.

http://linux.die.net/man/3/clock_gettime

wysota
27th January 2013, 23:53
It has to do with the windows qt environment and the way it spread the file in the filesystem....
Qt environment doesn't spread any files anywhere.


How can I check wether the lib is correctly reachable (presence/lib path) by the linker?
You can compile a program that uses it. If it fails, then it is not reachable.


Moreover the time.h include should contain the CLOCK_MONOTONIC define. Where can I find it ?
time.h? Probably in the place where you had put it. I don't see what Qt has to do with it. You're not even using Qt anywhere:
CONFIG -= qt