Compilation error error C2039: 'clock_t' : is not a member of '`global namespace''

10,665

Something, somewhere in your codebase is including a different "time.h". I just discovered this migrating code from Linux to Windows - Because windows is case insensitive, a local "Time.h" (note the capital) was included as "time.h", causing the error that you see.

According to someone's post, FFMPEG can cause this problem via this precise mechanism.

Please look through your codebase and/or libraries for a "time.h" to see if this is happening. Otherwise, an alternate option is to output the fully pre-processed source to see what is actually being compiled in the offending file.

Share:
10,665
Nem
Author by

Nem

Future belongs to those who believe in the beauty of their dreams!

Updated on June 04, 2022

Comments

  • Nem
    Nem almost 2 years

    I'm compiling in VS 2010 with boost 1_53. I'm also using boost's threads.

    during compilation i'm getting bunch of errors like this

    c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(18): error C2039: 'clock_t' : is not a member of '`global namespace''

    all errors are about ctime and c_time.hpp.

    i've searched around for the solution but without success.

    can anyone, please, help?

    here some part of code.

    #define BOOST_THREAD_USE_DLL 
    
    #include <boost/optional.hpp>
    #include <boost/thread.hpp>
    #include <boost/thread/thread.hpp>
    #include <boost/thread/mutex.hpp>
    #include <boost/date_time/posix_time/posix_time.hpp>