'System' : a namespace with this name does not exist

∥☆過路亽.° 提交于 2019-11-27 05:43:03

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/16732789/system-a-namespace-with-this-name-does-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!