hi guys im having an error with my code but cant seem to figure it out.

its a windows form and im just trying to make it function but the compiler gives me these errors:

1>c:\\\desktop\\c++\twisttut\twisttut\Form1.h(89) : error C2059: syntax error : '{'
1>c:\\\desktop\\c++\twisttut\twisttut\Form1.h(89) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body

This is my code

line 88	private: System::Void checkBox1_CheckedChanged(System::Object^  sender, System::EventArgs^  e);
			 {

				unsigned long oldProtect;
				VirtualProtect((LPVOID)SuperTubiAddy, 2, PAGE_EXECUTE_READWRITE, &oldProtect);

				if(this->checkBox1->Checked)
				{
				     memcpy((void*)SuperTubiAddy, enableSuperTubi, sizeof(enableSuperTubi));
				}
				else
				{
				    memcpy((void*)SuperTubiAddy, disableSuperTubi, sizeof(disableSuperTubi));
				}	
			 }
	};
line 104}

i have written the line numbers on the side please help thanks. :D

Recommended Answers

All 4 Replies

You have a semicolon after the function.

private: System::Void checkBox1_CheckedChanged(System::Object^  sender, System::EventArgs^  e); <--- this shouldn't be here
{
    //...
}

You have a semi-colon at the end of line 88, which should not be there. Because this is how the compiler interprets things:

void myFunction();     //declaration of "myFunction"

void myFunction()      //definition of "myFunction"
{
  //...
};

void myFunction();     //declaration of "myFunction"
{                      //ERROR: what is this { ? You cannot open a curly-brace in the middle of no-where.
  //...
};

but when i do that i get more errors of variable not specified or something like that.

I was reading a tutorial and thats what it said.

well umm lemme get you the errors as soon as i get back home.

until then im sure its a variable error in the compiler so any help on that?

>>im sure its a variable error in the compiler so any help on that?

And I'm sure your wrong. The compiler is never the problem (at least, extremely rarely, and only when doing really advanced stuff). Post more of the code, and implement the fix we suggested, then post the error messages that you get.

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.