错误C1190:托管目标代码需要'/ clr'选项 [英] error C1190: managed targeted code requires a '/clr' option

查看:226
本文介绍了错误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++, .net 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?

推荐答案

http://social.msdn.microsoft.com/Forums/en -US / 34844476-8e2f-4947-b715-eb69edaf60d9 / fatal-error-c1190-managed-targeted-code-requires-a-clr-option?forum = vclanguage [ ^ ]



http://forums.codeguru.com/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'选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆