'System' : a namespace with this name does not exist
build-error, c++, wpf
Solution
Set Common Language RunTime Support to be "Common Language RunTime Support (/clr)" in 2 places in your project properties :
For Visual Studio before 2019:
- Configuration Properties -> General
- Configuration Properties -> C/C++ -> General
For Visual Studio 2019:
- Configuration Properties -> Advanced -> C++/CLI Properties
- Configuration Properties -> C/C++ -> General
Problem
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.