Hi All,

A error message is thrown on the compilation of C++ code. The error message is

error: expected initializer before '*' token

Also i am attaching the C++ file here with.

/* $Id: Debug.h,v 1.1 2005/06/23 13:47:50 srinivasar Exp $ */

/*
 * Copyright 1999-2001 AdventNet, Inc. All Rights Reserved.
 * This software is the property of AdventNet, Inc. Distribution
 * or deployment of the source or derived binaries of this
 * software are not permitted without a OEM or distribution
 * license from AdventNet, Inc.
 */

/****************************************************************************
 *
 *  Files	: Debug.h
 *
 *  Purpose	: File contains debug and error message variables and function
 *			  prototypes.
 *
 *  Author	: V. Mathi vanan.
 *
 *  Date	: 2nd April 1999.
 *
 *****************************************************************************/

#ifndef DEBUG
#define DEBUG
#endif

#ifdef  __cplusplus
extern "C" {
#endif

#ifndef AGENTDEBUG_PUBLIC
#define AGENTDEBUG_PUBLIC extern
#endif /* AGENTDEBUG_PUBLIC */


AGENTDEBUG_PUBLIC unsigned int gv_nwDebugLevel;


/* ----------------------- Macros Declarations -------------------------*/

#ifdef CMD_ARGS
#define Printf1(msg) printf(msg)
#define Printf2(msg,arg1) printf(msg,arg1)
#define Printf3(msg,arg1,arg2) printf(msg,arg1,arg2)
#define Printf4(msg,arg1,arg2,arg3) printf(msg,arg1,arg2,arg3)
#else
#define Printf1(msg)
#define Printf2(msg,arg1)
#define Printf3(msg,arg1,arg2)
#define Printf4(msg,arg1,arg2,arg3)
#endif


#ifdef DEBUG

/* we are defining debug since it is first level of debug */
#define ERRMSG

#define DEBUGMSG1(msg)	{ if (gv_nwDebugLevel >= 1) { printtime(); fprintf(OUTPUT,msg); fflush(OUTPUT); } }
#define DEBUGMSG2(msg,arg) { if (gv_nwDebugLevel >= 1) { printtime(); fprintf(OUTPUT,msg,arg); fflush(OUTPUT); } }
#define DEBUGMSG3(msg,arg1,arg2) { if (gv_nwDebugLevel >= 1) { fprintf(OUTPUT,msg,arg1,arg2); fflush(OUTPUT); } }
#define DEBUGMSG4(msg,arg1,arg2,arg3) { if (gv_nwDebugLevel >= 1) { fprintf(OUTPUT,msg,arg1,arg2,arg3);fflush(OUTPUT); } }
#define DEBUGMSG5(msg,arg1,arg2,arg3,arg4) { if (gv_nwDebugLevel >= 1) { fprintf(OUTPUT,msg,arg1,arg2,arg3,arg4);fflush(OUTPUT); } }

#else 	/* ifndef ERRMSG */

#define DEBUGMSG1(msg)
#define DEBUGMSG2(msg,arg)
#define DEBUGMSG3(msg,arg1,arg2)
#define DEBUGMSG4(msg,arg1,arg2,arg3)
#define DEBUGMSG5(msg,arg1,arg2,arg3,arg4)


#endif	/* #ifdef DEBUG */

#ifdef ERRMSG

#define OUTPUT gp_fPtr

#define ERRMSG1(msg) { if (gv_nwDebugLevel >= 0 ) { fprintf(OUTPUT,msg); fflush(OUTPUT); } }
#define ERRMSG2(msg,arg) { if (gv_nwDebugLevel >= 0) { fprintf(OUTPUT,msg,arg); fflush(OUTPUT); } }
#define ERRMSG3(msg,arg1,arg2) { if (gv_nwDebugLevel >= 0) { fprintf(OUTPUT,msg,arg1,arg2); fflush(OUTPUT); } }
#define ERRMSG4(msg,arg1,arg2,arg3) { if (gv_nwDebugLevel >= 0) { fprintf(OUTPUT,msg,arg1,arg2,arg3);fflush(OUTPUT); } }

#else 	/* ifndef ERRMSG */

#define ERRMSG1(msg)
#define ERRMSG2(msg,arg)
#define ERRMSG3(msg,arg1,arg2)
#define ERRMSG4(msg,arg1,arg2,arg3)
#endif	/* #ifdef ERRMSG */

/* ----------------------- Function Prototypes ---------------------------*/

#if defined (ERRMSG)
#define OPENLOGFILE(fName) OpenLogFile(fName)
AGENTDEBUG_PUBLIC FILE *gp_fPtr;
AGENTDEBUG_PUBLIC char OpenLogFile(char *fName);
void printtime();
void printtimemsg(char *msg);
#else
#define OPENLOGFILE(fName)

#endif

#ifdef  __cplusplus
}
#endif


/***************************************************************************
 *						End of agentdebug.h
 ***************************************************************************/

Kindly help me out in debugging the issue.


Thanks & Regards,
Muthuselvan N

Compiles fine for me. Post the complete error-message, it usually comes with a line-number, so that we don't have to guess ;)

On line 98 I'm also getting an error when I'm compiling this:

Error E2141 testt.cpp 98: Declaration syntax error

I think FILE is throwing the error (line 98): AGENTDEBUG_PUBLIC FILE *gp_fPtr; As it isn't defined somewhere ...

FILE should be defined in <cstdio> (or <stdio.h> for C)

Using #include <stdio.h> the code is compiling with me :) ...

Hi All,

Thanks a lot guys, as the problem is fixed on updating the source code with inclusion of #include <stdio.h>.

Regards,
Muthuselvan N

This article has been dead for over six months. Start a new discussion instead.