mars icon indicating copy to clipboard operation
mars copied to clipboard

fatal error C1083: 无法打开包括文件: “thr/threads.h”

Open oraclexbw opened this issue 6 years ago • 3 comments

build_windows.py 之后,出现55个错误,说是无法打开thr/threads.h,有大神遇到相同问题吗? 用的开发环境是windows10 visualstudio 2017

oraclexbw avatar Apr 24 '19 09:04 oraclexbw

这个是系统库,应该是环境问题,建议使用 vs2015 编译。

garryyan avatar May 14 '19 10:05 garryyan

vs2019编译成功

修改以下文件即可 1、mars\comm\thread\spinlock.h line 112行修改为如下

#if _MSC_VER > 1900
    #include <xthreads.h>
#else
    #include <thr/threads.h>
#endif

2、mars\comm\windows\thread\thread.h 有两处

line 20 修改成如下:

#if _MSC_VER > 1900
    #include <xthreads.h>
    typedef _Thrd_t thrd_t;
    using _Thrd_start_t = int (*)(void*);
    typedef _Thrd_start_t thrd_start_t;

    _CRTIMP2_PURE int __cdecl _Thrd_create(_Thrd_t*, _Thrd_start_t, void*);
    _CRTIMP2_PURE _Thrd_t __cdecl _Thrd_current(void);

    #define thrd_create(thr, fun, arg)	_Thrd_create(thr, fun, arg)

    #define thrd_detach(thr)		_Thrd_detach(thr)

    #define thrd_join(thr, res)		_Thrd_join(thr, res)
    #define thrd_sleep(tm)			_Thrd_sleep(tm)
    #define thrd_yield				_Thrd_yield
    #define thrd_current			_Thrd_current
#else
    #include <thr/threads.h>
#endif

line36


#if _MSC_VER > 1900
#include <xthreads.h>
#else
#include <thr/threads.h>
#endif

3、mars\comm\windows\TssGC.h line19

#if _MSC_VER > 1900
#include <xthreads.h>
typedef void (*_Tss_dtor_t)(void*);
typedef _Tss_dtor_t tss_dtor_t;
#else
#include <thr/threads.h>
#endif

4、mars\comm\windows/unistd.c 文件名改成unistd.cpp

line2

#if _MSC_VER > 1900
#include <xthreads.h>
#define thrd_sleep(tm)			_Thrd_sleep(tm)
#else
#include <thr/threads.h>
#endif

yuangu avatar Jan 21 '21 07:01 yuangu

build_windows.py 之后,出现55个错误,说是无法打开thr/threads.h,有大神遇到相同问题吗? 用的开发环境是windows10 visualstudio 2017

问题解决了吗?

fanwu91 avatar Mar 31 '22 13:03 fanwu91