Reputation: 13
I'm getting a series of odd errors when I try to compile a VS2010 Windows Form Application. The errors that I'm getting are:
error C2871: 'project_6' : a namespace with this name does not exist
error C2653: 'Application' : is not a class or namespace name
error C3861: 'EnableVisualStyles': identifier not found
error C2653: 'Application' : is not a class or namespace name
error C3861: 'SetCompatibleTextRenderingDefault': identifier not found
error C2653: 'Application' : is not a class or namespace name
error C2061: syntax error : identifier 'Form1'
error C3861: 'Run': identifier not found
error C1854: cannot overwrite information formed during creation of the precompiled header in object file: 'c:\users\dan\documents\visual studio 2010\projects\project_6\debug\stdafx.obj'
All of the compiler errors give the file as my main.cpp file save the last one, which gives stdafx.cpp. Below is my main.cpp file (it's the one VS2010 automatically generates):
// 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;
}
Anyways, I'm at my wit's end trying to figure out what's wrong with it, and was hoping somebody here could lend some insight.
Upvotes: 1
Views: 586
Reputation: 311088
I think you need to add at least references to System.Windows.Forms and System.Windows.Drawing.
Upvotes: 0