我有一个运行完美的 C++ 项目。现在,我将该项目复制到另一个文件夹,并将该项目添加到 WPF 应用程序解决方案中。
现在 C++ 项目给我带来了很多构建错误。其中之一是"System' : a namespace with this name does not exist"
.
以下是产生此错误的行。
#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;
上面几行是在程序集信息.cpp文件。我没有任何 C++ 经验,因此发现很难消除错误。任何帮助表示赞赏。以下是另一个错误,可能有助于您解决问题。
managed targeted code requires a '/clr' option
提前致谢。
将公共语言运行时支持设置为“公共语言运行时支持 (/clr)”2项目属性中的位置:
对于 2019 年之前的 Visual Studio:
- 配置属性->常规
- 配置属性 -> C/C++ -> 常规
对于 Visual Studio 2019:
- 配置属性 -> 高级 -> C++/CLI 属性
- 配置属性 -> C/C++ -> 常规
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)