c++ fatal error C1189: #error:解决方案

c++C1189错误解决方案:

fatal error C1189:

方案1

方案2:修改源码:

 LNK1104: cannot open file 'MSCOREE.lib'


fatal error C1189:

错误类型:(atl)

1、C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\mutex(8): fatal error C1189: #error:  <mutex> is not supported when compiling with /clr or /clr:pure.

2、C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\thread(8):fatal error C1189: #error:  <thread> is not supported when compiling with /clr or /clr:pure.

方案1

参考博客:https://blog.csdn.net/v_zhangyang/article/details/69784024

方案2:修改源码:

修改C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\mutex 文件:

#ifndef RC_INVOKED

#ifdef _M_CEE
#ifndef _CLR_NATIVE_THREADS  //添加运行时原生线程
#error <mutex> is not supported when compiling with /clr or /clr:pure.
#endif /* _CLR_NATIVE_THREADS */
#endif /* _M_CEE */

添加#ifndef _CLR_NATIVE_THREADS    #endif

同理修改thread文件

 LNK1104: cannot open file 'MSCOREE.lib'

解决方案:

如果出现这个链接错误,请添加library directories: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib (请根据自身电脑Microsoft SDKs文件位置添加)

或者修改如下(链接器处添加(主流方式))

 

写在最后:

文章来源项目实践,文章存在任何问题,请指正错误,谢谢您的阅读! 

转载请您注明来源,谢谢你!

发布了35 篇原创文章 · 获赞 8 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/wenming111/article/details/103731896