Quick Question!

Jul 16, 2013 at 3:19pm
// Project1.cpp : main project file.

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

using namespace Project1;

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

I'm getting an error saying:
fatal error C1075: end of file found before the left brace '{'
Does anyone know how to fix this?
Last edited on Jul 16, 2013 at 3:19pm
Jul 16, 2013 at 3:27pm
closed account (Dy7SLyTq)
put in the missing {
Jul 16, 2013 at 3:39pm
I haven't been able to find a missing brace?
Jul 16, 2013 at 3:47pm
I have one for you:

 
{
Jul 16, 2013 at 4:05pm
The missing brace might be in your header file
Jul 16, 2013 at 5:54pm
Okay, I'll check in my header file.
Jul 16, 2013 at 5:59pm
closed account (Dy7SLyTq)
@disch: but wouldnt it say in the header file? excuse my ignorace, but i use mingw, not visual studios so i dont know the speficity (?) of the error commands. i only ask because i know gcc does
Jul 16, 2013 at 6:05pm
@DTSCode: Not necessarily. It's perfectly legal for a header to have mismatching {braces}. Remember header files are not compiled, they're #included. #include is a glorified copy/paste.

This is perfectly legal:

1
2
// a.h
{

1
2
// b.h
}

1
2
3
4
5
6
// main.cpp

int main()
#include "a.h"
    return 0;
#include "b.h" 
Jul 16, 2013 at 6:06pm
closed account (Dy7SLyTq)
oh duh... because a macro literally expands the command with what its getting replaced by right?
Jul 16, 2013 at 7:12pm
#include is a preprocessor directive. One uses the #define preprocessor directive to create a preprocessor macro.

You've got the right idea. The terminology is a little off.
Last edited on Jul 16, 2013 at 7:12pm
Jul 16, 2013 at 7:14pm
closed account (Dy7SLyTq)
sorry i shouldnt have used macro.
Jul 16, 2013 at 8:29pm
I found the missing brace. Didn't realize it could be in the header file.
Topic archived. No new replies allowed.