#### Archived

This topic is now archived and is closed to further replies.

# Odd Error

This topic is 5406 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Making a MFC Window w/ Opengl and my code generates an error: ============== c:\projects\ren\cwindow.cpp(14) : error C2143: syntax error : missing '';'' before ''PCH creation point'' Error executing cl.exe. ============== I cant seem to find what the hell it is looking for if you need code the error happens right before the constructor:  ////CWindow //constructor and destructor CWindow::CWindow(){ Create(NULL,"Ren"); }  Thanx if you can help me! - Lurking

##### Share on other sites

Either you are missing a '';'' in your source file or have forgotten to declare a type.

Look BEFORE line 14 (e.g. at the end of a class declaration in an #include file)

##### Share on other sites
Most likely, you are missing '';'' in one of your headers. Are you doing this?
// Globals.h#include <stuff>void myfn();extern char mystring[];// main.cpp#include "globals.h"void myfn(){    ....}

Make sure there are no syntax errors in globals.h (ie: missing '';''). Another way is this:
// Globals.h// No headersvoid myfn();extern char mystring[];// main.cpp#include <stuff>#pragma hdrstop#include "Globals.h"// Code

This can give you other (more sensible) error message.

However, if you are using MFC, you should be doing this:
// stdafx.h#include <afxstuff.h>// No your stuff in this header// globals.h// put your stuff here// main.cpp (or whatever you have)#include "stdafx.h"#include "globals.h"// code

Make sure stdafx.h is the first line in your .cpp files

It''s a good habit to have separate file for pch anyway (I always do). (ie: stdafx.h/cpp).

In case you don''t know: pch stands for precompiled header file. It''s when compiler compiles all those headers once and for all, and when you want to compile your .cpp, it just compiles your code, and not your code and all headers it uses. This results in faster (almost instant) build times for all .cpp files except the one used to create pch. If you use a blank file to create pch (take a look at stdafx.cpp), then all your files are built in no time when you change them. To convince yourself, compile a MFC project that includes a (insert large number here) of headers and a GL project that only uses gl.h and windows.h. Now change one line in a source file and recompile. MFC file should compile faster.

Hope I explained this clearly enough.

##### Share on other sites
i had the same error it took me 5 hours to figur it out it's its like this

class
{
};// this semicolon is a must

1. 1
2. 2
Rutin
17
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633735
• Total Posts
3013595
×