bigbaz34
bigbaz34

Reputation: 395

Visual C++ Compiler error 2061

I am new to Visual C++ so please don't bite my head off. I can't figure out why I am getting this error. I have added an include of Parts.h in my Form1.h and I believe I have the correct code to call it. If anyone could help me to put this right I would be grateful.

This is the error:

Error   1   error C2061: syntax error : identifier 'Parts'  c:\users\*********\documents\visual studio 2005\projects\machinev.2\machinev.2\Form1.h  116

This is the code:

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                 Parts ^Parts = gcnew Parts();
                 Parts->ShowDialog();

Upvotes: 1

Views: 219

Answers (1)

Alex F
Alex F

Reputation: 43321

Parts^ parts = gcnew Parts();
parts->ShowDialog();

Don't use the same name for class and variable.

Upvotes: 3

Related Questions