错误C1190:托管目标代码需要'/ clr'选项

编程入门 行业动态 更新时间:2024-10-26 16:22:46
本文介绍了错误C1190:托管目标代码需要'/ clr'选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

已经发现了很多这个错误,但我的情况还没有与之相匹配。 我正在调试中构建一个解决方案(有很多项目)模式,其中一个是抛出这个错误,我使用的是VS2010,语言是C ++,。net 4.0版,之前这个项目是在vs2008和VS2010中编译的,现在一切都还好,现在我有一台新机器了只是安装了VS2010,现在面临这个错误。 要注意的主要事项是:属性设置:1)项目配置 - > General-> / CLR被选中2 )在C ++中 - > General->没有CLR支持 我自从过去以来一直使用这些设置,只有在相同的调试模式下,它在VS2010的旧机器上才能正常运行。 如果我在两种设置中打开/ Clr支持,一般和c ++ - >一般两者,我得到另一个错误:错误C2855:命令行选项'/ clr'与预编译头我删除.pch文件不一致,并重新创建它,即使这样,这个错误仍然存​​在。 怎么办?

Found a lot on this error already, but my case does not get matched with any yet. I am building a solution (having many projects) in debug mode, and one of them is throwing this error, I am using VS2010 and language is C++, version 4.0, earlier this project was compiled in vs2008 and then VS2010, and it was all ok, now I got a new machine which has just VS2010 installed and now facing this error. main thing to notice is: Properties settings: 1) Project Configuration->General->/CLR is chosen 2) In C++->General-> No CLR support I am having these settings since past, it's running all fine in my old machine in VS2010 only in the same debug mode. If I turn on /Clr support in both the settings, general and c++-> general both, I got another error: error C2855: command-line option '/clr' inconsistent with precompiled header I deleted .pch file,and recreated it, even then, this error persists. What to do?

推荐答案

social.msdn.microsoft/Forums/en -US / 34844476-8e2f-4947-b715-eb69edaf60d9 / fatal-error-c1190-managed-targeted-code-requires-a-clr-option?forum = vclanguage [ ^ ] forums.codeguru/showthread.php?418133-How-to-r非常长的SQL语句 [ ^ ]

关于预编译头的第二个问题,看起来你的Stdafx.cpp被编译了没有/ clr选项。您也需要在那里切换它(可能导致其他类的问题);或者将预编译标题选项(在C / C ++中 - 预编译标题)设置为不使用预编译标题,而不是在.cpp文件中包含Stdafx.h。 我不喜欢我不知道为什么它在旧机器上工作。 Regarding the second problem with the precompiled header, it looks like your Stdafx.cpp is compiled without the /clr option. You either need to switch it on there as well (possibly leading to problems with other classes); or set the Precompiled Header option (in C/C++ - Precompiled Headers) to Not Using Precompiled headers and not include Stdafx.h in your .cpp file. I don't know why it worked on the old machine.

更多推荐

错误C1190:托管目标代码需要'/ clr'选项

本文发布于:2023-11-10 06:38:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项   错误   目标   代码   clr

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!