编译错误错误C2039:“clock_t”:不是“全局名称空间”的成员

时间:2020-12-16 09:43:59

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

我将在VS 2010中编译,使用boost 1_53。我也在使用boost的线程。

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''

c:\程序文件(x86)\微软visual studio 10.0\vc\包括\ctime(18):错误C2039:“clock_t”:不是“全局名称空间”的成员

all errors are about ctime and c_time.hpp.

所有的错误都是关于ctime和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>

1 个解决方案

#1


10  

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.

某些东西,在你的代码库中的某个地方,包括一个不同的“时间。h”。我刚刚发现了从Linux到Windows的迁移代码——因为Windows是不区分大小写的,是本地时间。h(注:大写字母)是“时间”。导致你看到的错误。

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

根据某人的帖子,FFMPEG可以通过这个精确的机制引起这个问题。

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.

请仔细查看你的代码库和/或库。看看这是否发生。否则,另一种选择是输出完全预处理的源代码,以查看在违规文件中实际编译的内容。

#1


10  

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.

某些东西,在你的代码库中的某个地方,包括一个不同的“时间。h”。我刚刚发现了从Linux到Windows的迁移代码——因为Windows是不区分大小写的,是本地时间。h(注:大写字母)是“时间”。导致你看到的错误。

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

根据某人的帖子,FFMPEG可以通过这个精确的机制引起这个问题。

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.

请仔细查看你的代码库和/或库。看看这是否发生。否则,另一种选择是输出完全预处理的源代码,以查看在违规文件中实际编译的内容。