'System':具有此名称的命名空间不存在 [英] 'System' : a namespace with this name does not exist
问题描述
我有一个C ++项目,运行完美。现在我将项目复制到另一个文件夹,并将项目添加到WPF应用程序解决方案。
现在C ++项目给我很多构建错误。其中之一是System':此名称的命名空间不存在
。
以下是创建此错误的行。
#include stdafx.h
使用命名空间System;
using namespace System :: Reflection;
using namespace System :: Runtime :: CompilerServices;
using namespace System :: Runtime :: InteropServices;
using namespace System :: Security :: Permissions;
上述行在 AssemblyInfo.cpp 文件中。我没有任何C ++的经验,所以发现它很难删除错误。任何帮助是赞赏。以下是另一个可能有助于您解决问题的错误。
受管理的目标代码需要'/ clr'选项$提前感谢。 将公共语言运行时支持设置为项目属性中 2 个位置中的公共语言运行时支持(/ clr):
配置属性 - >常规
配置属性 - > C / C ++ - >常规
I had a C++ project which was running perfectly. Now I copied the project to another folder and added the project to a WPF application solution.
Now the C++ project is giving me lot of build errors. One of them is "System' : a namespace with this name does not exist"
.
Below are the lines which creates this error.
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
The above lines are in AssemblyInfo.cpp file. I don't have any experience of C++, so finding it difficult to remove the errors. Any help is appreciated. Below is another error which might be helpful for you to resolve the issue.
managed targeted code requires a '/clr' option
Thanks in advance.
解决方案 Set Common Language RunTime Support to be "Common Language RunTime Support (/clr)" in 2 places in your project properties :
Configuration Properties -> General
Configuration Properties -> C/C++ -> General
这篇关于'System':具有此名称的命名空间不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!