i have a empty c++ win32 console program Peter.cpp and a window form John.h added.

a error of " error C2061: syntax error : identifier 'John' " just comes out due to the code " Application::Run(new John); " when complie.

could you please help me to fix the program? thank you!!

//John.h
#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

namespace Peter {

	/// <summary>
	/// Summary for John
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class John : public System::Windows::Forms::Form
	{

	public:
		John(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~John()
		{
			if (components)
			{
				delete components;
			}
		}

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = gcnew System::ComponentModel::Container();
			this->Size = System::Drawing::Size(300,300);
			this->Text = L"John";
			this->Padding = System::Windows::Forms::Padding(0);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
        }
#pragma endregion
	};
}
// Peter.cpp 
//
#include "stdafx.h"
#include "John.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/*
#using<mscorlib.dll>
using namespace System;
#using<System.DLL>
#using<System.Windows.Forms.dll>
using namespace System::Windows::Forms;
*/



int _tmain(int argc, _TCHAR* argv[])
{
	    Application::Run(new John);

		return 0;
}

Application::Run(new John);

try to use Application::Run(gcnew John);
instead..

Or maybe Application::Run(gcnew John());

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.