[英]C++ Visual Studio 2012 issues
更新问题#3
我已经解决了问题。 似乎仅包含<thread>
会使编译器发疯。 我什至不进行任何线程调用,仅包括它。
我试过启用/ EHsc并也禁用它。
残疾人,我得到:
我收到以下6条消息:
Error 1 error C2220: warning treated as error - no 'object' file generated (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Warning 2 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Error 3 error C2220: warning treated as error - no 'object' file generated (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Warning 4 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Error 5 error C3861: '__uncaught_exception': identifier not found (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
Error 6 error C3861: '__uncaught_exception': identifier not found (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
并且如果启用(配置属性-> C / C ++->代码生成和在命令行中)
Error 1 error C3861: '__uncaught_exception': identifier not found (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
Error 2 error C3861: '__uncaught_exception': identifier not found (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
我对一个新的空白项目(包括线程和编译)进行了简单的测试。 一切顺利,没有错误。 但是,在我的主项目中,我使用的是Chromium Embedded Framework v3,它似乎与线程包含异常交互?
似乎很奇怪,仅将其包含在内就会造成混乱。
有任何想法吗?
更新:
通过完全删除_HAS_EXCEPTIONS = 0标志并从CMake重建项目,我进入了一个项目甚至无法编译的状态。 由于此更改,它会从各种文件中抛出大量警告和错误。
错误例如:
Warning 230 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (C:\Users\mads\Desktop\cef_binary_3.2526.1347.gcf20046_windows32\cefclient\browser\client_handler_osr.cc) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale 337 1 cefclient
根据很多询问和查询,解决方案是在项目属性-> C / C ++->代码生成->启用C ++异常= Yes(/ EHsc)中指定/ EHsc。 以及在命令行输入字段中设置标志/ EHsc。
但是,没有任何变化。 出现相同的错误,好像什么都没有更改。
更新:
错误
Warning 2 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (C:\Users\mads\Desktop\cef_binary_3.2556.1368.g535c4fb_windows32\libcef_dll\transfer_util.cc) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale 337 1 libcef_dll_wrapper
来自项目“ libcef_dll_wrapper”,尽管事实上我在其项目设置中使用了/ EHsc! 在C ++中->代码生成页面和命令行
解决方案编辑:
事实证明,每次我尝试构建或运行项目时,cmake文件都将覆盖我的设置设置,因此,尽管设置了设置,但仍渲染了我未使用的任何更改! 通过直接编辑项目的cmake文件,我能够解决此问题。 以前从未使用过cmake,因此最终它成为一种学习体验。 我已经用线程包含测试了我的项目,并且可以按预期编译!
感谢所有的伟大建议
确保代码和编译器命令行均未定义_HAS_EXCEPTIONS = 0。
使用_HAS_EXCEPTIONS = 0编译VC ++ 12.0并包含concrt.h会导致编译器错误 :
如果使用VC ++ 12.0将_HAS_EXCEPTIONS设置为0的源文件进行编译,并且源文件直接或间接包含concrt.h,则编译器将给出以下错误:
C:\\ Program Files(x86)\\ Microsoft Visual Studio 12.0 \\ VC \\ INCLUDE \\ concrt.h(4774):错误C3861:'__uncaught_exception':找不到标识符
[...]宏_HAS_EXCEPTIONS = 0未记录,Microsoft不支持。 由于遗留原因,它可能与STL库的某些部分一起使用,但由于ConcRT依赖于取消的异常,因此它与ConcRT库(concrt.h)不兼容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.