Only have Visual Studio 2008 about a week but just ran into something inexplicable to me. This include file (and others like it)...

//DoTestData.h
#ifndef DOTESTDATA_H
#define DOTESTDATA_H

unsigned int iCreateDB(TCHAR*);
unsigned int blnMakeTable(SQL&);   
int GetRecordCount(SQL&, unsigned int&);
unsigned int blnInsert(SQL&, TCHAR**, unsigned int&, HWND, int);
unsigned int blnDumpData(SQL&, TCHAR**, unsigned int&, HWND);
void btnAccess_OnClick(lpWndEventArgs);
void btnSqlServerExpress_OnClick(lpWndEventArgs); 
void btnSqlServerMSDE_OnClick(lpWndEventArgs);
 
#endif

...generate this error...

c:\code\vstudio\vc++9\sqldemo\DoTestData.h(5) :
error C2144: syntax error : 'unsigned int' should be preceded by ';'

Why in the world should I have to place a semicolon before a line? At a total loss as to why I would have to place a semicolon before a line but wanting the darn thing to compile I thought, "Well, its ridiculous, but if it wants one before the line I'll put it there and see what happens!" Sure enough, it compiled! (Runs too). Here is the changed code with a semicolon before the 'unsigned int'. What in the world is going on???

//DoTestData.h
#ifndef DOTESTDATA_H
#define DOTESTDATA_H

;unsigned int iCreateDB(TCHAR*);
unsigned int blnMakeTable(SQL&);   
int GetRecordCount(SQL&, unsigned int&);
unsigned int blnInsert(SQL&, TCHAR**, unsigned int&, HWND, int);
unsigned int blnDumpData(SQL&, TCHAR**, unsigned int&, HWND);
void btnAccess_OnClick(lpWndEventArgs);
void btnSqlServerExpress_OnClick(lpWndEventArgs); 
void btnSqlServerMSDE_OnClick(lpWndEventArgs);
 
#endif

You've got

#include "somethingElse.h"
#include "DoTestData.h"

The last thing in somethingElse.h is the real cause of the problem, and it will be missing the ; in question.

commented: Nice. +23
commented: Logic prevails! +23

Are you including other header file that has classes?

If so then the class is probably missing a semicolon at the end of
its definition.

class A
{ ... 
} ; <--- need semi-colon?

If you do not have class defined in other header file, then something is missing a semi-colon.

Thanks Salem & firstPerson. That was it. I copied the 1st line of a procedure in a .cpp file to a .h file for a prototype, and forgot to put a semicolon at the end.

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.