Error is thrown on Compilation of C++ Code


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Error is thrown on Compilation of C++ Code

  1. #1
    Join Date
    Apr 2009
    Posts
    1

    Error is thrown on Compilation of C++ Code

    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.
    Code:
    #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 in Advance,
    Muthuselvan N
    Last edited by jazzezselvan; 04-10-2009 at 06:15 AM. Reason: updated source code

  2. #2
    Join Date
    May 2007
    Posts
    843
    Which line causing the error ?

  3. #3
    Join Date
    Nov 2003
    Posts
    4,118
    probably a macro mess. You'll need to isolate the line that causes this error.
    Danny Kalev

Similar Threads

  1. Jupitermedia Legal Notice -- NO PERMISSION TO USE CODE SAMPLES?!
    By Noryk Rekrap in forum Talk to the Editors
    Replies: 3
    Last Post: 08-23-2007, 03:56 PM
  2. Control Arrays in VB.NET
    By Gary Nelson in forum .NET
    Replies: 277
    Last Post: 10-01-2003, 12:00 AM
  3. Microsoft's C++ bigotry
    By Phil Weber in forum .NET
    Replies: 632
    Last Post: 10-01-2003, 12:00 AM
  4. .NET equals Efficiency
    By Kevin in forum .NET
    Replies: 150
    Last Post: 03-04-2002, 05:40 PM
  5. Replies: 90
    Last Post: 04-17-2001, 12:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center