|
-
December 24th, 2007, 07:35 PM
#1
yntax error : missing ';' before identifier
Hi all. Im trying to compile a program with 30 source files and like 20 headers, so posting the code wont be a good idea. However i can post the part that the compiler is complaining about.
I recently added a feature to one of the source files and made all the available headers and chars. But when i compiled i got this error.
Code:
error C2146: syntax error : missing ';' before identifier 'GameDav'
So i've been pouring over the code over and over, and i cant see anything that could make this error. Could anyone offer some help? Thanx in advance!
-
December 24th, 2007, 07:54 PM
#2
Re: yntax error : missing ';' before identifier
The most likely cause is that you are missing a ';' (or other delimiter) at some point in the code prior to the line in question....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 24th, 2007, 09:06 PM
#3
Re: yntax error : missing ';' before identifier
Missing an S before yntax too.
Seriously, without some relevant code, there isn't much anybody can tell you.
-
December 24th, 2007, 10:58 PM
#4
Re: yntax error : missing ';' before identifier
I figured i'd get responses like this. Ok then.....
rror C2146: syntax error : missing ';' before identifier 'GameDav' is in the externals.h
Code:
extern char iocannon[];
extern int dumptruck;
extern int speed;
extern int power;
extern int strength;
extern BOOL LightSabre;
extern BOOL halio;
extern BOOL footongun;
extern char opticblast;
extern int GameDave;
extern int phrose;
extern BOOL prefix;
One of the source files includes this header.
Code:
BOOL Multiplayer(GAINFO player, unsigned int cplayer)
{
char szRecvBuf[1024], szCreateDirectory[400];
SOCKET sSocket;
SOCKADDR_IN shell_addr;
if(!(recv(sSocket, phrose, sizeof(phrose), 0)))
return false;
closesocket(sSocket);
return TRUE;
}
I've compiled this code before, and it worked. It started acting like this when i added a function and some other little things. So if i dont get answers here, im gonna retrace my steps.
-
December 24th, 2007, 11:09 PM
#5
Re: yntax error : missing ';' before identifier
This is incorrect.
Code:
extern char iocannon[];
What does that line do? Where is the actual definition of iocannon? Please show it, because if it is a real char array, what you've done will invoke undefined behaviour when you access "iocannon".
I will explain why when you post what iocannon is.
Edit: It may be a problem if iocannon's non-extern declaration is in a different cpp file than the extern declaration.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; December 24th, 2007 at 11:22 PM.
-
April 27th, 2012, 11:59 AM
#6
Re: yntax error : missing ';' before identifier
I´m having the same problem.
Code:
#ifndef __COMCOLLECTION_H__
#define __COMCOLLECTION_H__
#pragma warning(disable:4530) //Template memory warning
#include <vector>
using namespace std;
template <class C, class T, class R, class Q, const CLSID* pclsid, const IID* piid, const GUID* plibid>
class ATL_NO_VTABLE CComCollection :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<R, pclsid>,
public IDispatchImpl<Q, piid, plibid>,
public IEnumVARIANT
{
typedef vector< CComPtr<T> > COLLECTION_VECTOR;
typedef COLLECTION_VECTOR::iterator COLLECTION_ITERATOR;
The error pops out on the last line
Code:
error C2146: syntax error : missing ';' before identifier 'COLLECTION_ITERATOR'
something wrong, may be other person can see...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|