Results 1 to 4 of 4

Thread: "error: 'clock_gettime' was not declared in this scope" and "error: 'CLOCK_MONOTONIC"

  1. #1
    Join Date
    Jan 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default "error: 'clock_gettime' was not declared in this scope" and "error: 'CLOCK_MONOTONIC"

    Usung qt 4.8.1 unde windows. compiling "pure" c++ code i get the following errors:

    Qt Code:
    1. trigwiz.h:149: error: 'CLOCK_MONOTONIC' was not declared in this scope
    2. trigwiz.h:149: error: 'clock_gettime' was not declared in this scope
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. TEMPLATE = app
    2. CONFIG += console
    3. CONFIG -= qt
    4.  
    5. SOURCES += main.cpp \
    6. trigwiz.cpp
    7.  
    8. HEADERS += \
    9. trigwiz.h
    10.  
    11. LIBS += -lpthread -lrt
    To copy to clipboard, switch view to plain text mode 

    unfortunately it was unsuccessfull...

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: "error: 'clock_gettime' was not declared in this scope" and "error: 'CLOCK_MONOTO

    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
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Jan 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: "error: 'clock_gettime' was not declared in this scope" and "error: 'CLOCK_MONOTO

    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 ?


    Quote Originally Posted by amleto View Post
    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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: "error: 'clock_gettime' was not declared in this scope" and "error: 'CLOCK_MONOTO

    Quote Originally Posted by brunialti View Post
    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:
    qmake Code:
    1. CONFIG -= qt
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 32
    Last Post: 26th August 2012, 00:10
  2. Replies: 2
    Last Post: 28th February 2010, 08:38
  3. "Treat wchar_t as Built-in Type" to "yes" link error
    By sungaoyong in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 12:45
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 16:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.