Error 26 error C2061: syntax error : identifier 'Form1' c:\Users\Black Chocobo\Desktop\WaveMachine\managesongs\WaveMachine\WaveMachine\WaveMachine\WaveMachine.cpp 16

// Create the main window and run it
	Application::Run(gcnew Form1.h());

Recommended Answers

All 12 Replies

Take out the .h, that's the filename, you want to instantiate an object of type Form1. Application::Run(gcnew Form1());

I still get the same error by removing the .h extension

Did you rename your Form1 class something else?

its Form1.h, they are both the same... would it have anything to do with one of the other errors? this is the only error relating to the form1.cpp where as the 25 others relate to form1.h

another note, my form1.cpp is actually called WaveMachine.cpp, the reference appears to have been the same so I cannot believe that changing the .cpp name to form1 would be the issue

The file names are irrelevant. What is you class called?

Which other errors?

There is no form1.cpp (unless you specifically created a file with that title), so that shouldn't matter.

The IDE should have autogenerated the code you posted above, that's why having the .h there was suspect.

There should be a line in your form1.h that says something like public ref class Form1 : public System::Windows::Forms::Form Check and make sure it says Form1 there.

Sorry to be a pain, im beginner

I have three header files,
AddWaveTrack_form1.h
EditWaveTrack_form1.h
Form1.h (25 Errors)

And then I have my Source Files,
AddWaveTrack_form1.cpp
EditWaveTrack_form1.cpp
WaveMachine.cpp (1 Error aka this one)

Ok so I found:

public ref class Form1 : public System::Windows::Forms::Form

added a 1 onto the form at the end, this generated 50 errors one of them being:

Error 1 error C2039: 'Form1' : is not a member of 'System::Windows::Forms' c:\users\black chocobo\desktop\wavemachine\managesongs\wavemachine\wavemachine\wavemachine\Form1.h 29

does it require .h? UPDATED no change 1 extra error

the start of my form1.h goes like this:

#pragma once


#include "AddWaveTrack_form1.h"
#include "EditWaveTrack_form1.h"

namespace WaveMachine {

	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 namespace System::IO;

	using namespace System::Media;

	/// <summary>
	/// Summary for Form1
	///
	/// 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 Form1 : public System::Windows::Forms::Form
	{

So, your WaveMachine.cpp file should look something like this:

// WaveMachine.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"

using namespace WaveMachine; //is this line intact?

[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;
}

that is correct mine is exactly the same...

I don't know what it is then. See what happens once you've corrected the other errors.

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.