Visual Studio 2010在编译C++/CLI项目时出现奇怪错误
Visual Studio 2010 giving odd errors compiling C++/CLI project
当我试图编译VS2010 Windows窗体应用程序时,遇到了一系列奇怪的错误。我得到的错误是:
错误C2871:"project_6":具有此名称的命名空间不存在
错误C2653:"Application":不是类或命名空间名称
错误C3861:"EnableVisualStyles":找不到标识符
错误C2653:"Application":不是类或命名空间名称
错误C3861:"SetCompatibleTextRenderingDefault":找不到标识符
错误C2653:"Application":不是类或命名空间名称
错误C2061:语法错误:标识符"Form1"
错误C3861:"运行":找不到标识符
错误C1854:无法覆盖在对象文件"c:\users\dan\documents\visual studio 2010\projects\project_6\debug\stdafx.obj"中创建预编译头期间形成的信息
所有的编译器错误都将该文件作为我的main.cpp文件,除了最后一个,它给出了stdafx.cpp。下面是我的main.chpp文件(它是VS2010自动生成的文件):
// project_6.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
using namespace project_6;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
无论如何,我已经无计可施了,正试图弄清楚它出了什么问题,希望这里有人能提供一些见解。
我认为您至少需要添加对System.Windows.Forms和System.Windows.Drawing.的引用
相关文章:
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- 错误-我无法在VS2019中打开新的Qt项目
- 将QT项目导入Visual Studio 2019会给我带来很多LNK2001错误
- VS 2015 链接错误 无法构建依赖于 libcurl 的项目
- 尝试将 boost::stacktrace 添加到 CMake 项目时出现构建错误
- 在编译时,C++项目抛出错误 C2228,这是预期的,因为控件在运行时未达到该点
- 编译器现在遵循C++14标准,我的项目不再编译神秘的SFML错误
- 标头,包括在 Swift 项目中使用C++文件时的错误
- 从加密项目向量中解密任意选择的元素会导致无效的 PKCS #7 块错误
- 错误 MSB8040:此项目需要 Spectre 缓解的库
- xtr1common中的错误,尝试使用VS2019构建原始VS2013 C++项目时type_traits
- 如何摆脱导入的 make 项目中的 Eclipse 索引器"Type std::... could not be resolved"错误
- Eclipse/CDT_C++给出"语义错误_"类型XXX无法解决"。项目运行
- CMake 错误,在构建 VTK 'INSTALL'项目
- 欧拉项目 #8 C++ 得到错误的答案
- 编译 OpenBLAS C++项目会产生错误"Undefined symbols for architecture x86_64"
- CMAKE 错误项目文件无效;不包含 cmakelists.txt
- Cmake错误:项目中使用了以下变量,但它们被设置为NOTFOUND,试图在archlinux中编译Rigs of Ro