Thread: Error compiling smtp.c in struct smtpSink - I don't see any problems with the syntax?

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    2

    Question Error compiling smtp.c in struct smtpSink - I don't see any problems with the syntax?

    I'm still a bit of a C newbie, so there might be a few beginner mistakes.

    When I try to compile my smtp.c file, it gives me these errors:

    Code:
    In file included from smtp.c:3:
    /home/dominique/smtp/smtp.h:11: error: expected ‘)’ before ‘*’ token
    /home/dominique/smtp/smtp.h:12: error: expected ‘;’ before ‘void’
    smtp.c: In function ‘main’:
    smtp.c:82: error: redefinition of ‘l_psmtpClient’
    smtp.c:9: error: previous definition of ‘l_psmtpClient’ was here
    smtp.c:141: error: redefinition of ‘l_psmtpClient’
    smtp.c:82: error: previous definition of ‘l_psmtpClient’ was here
    The error about the header file really puzzles me, because I don't see anything wrong with the syntax in smtp.h:

    Code:
    // smtp.h
    #define NSMAIL_OK 0
    
    int l_retCode;
    
    typedef struct smtpClient smtpClient_t;
    
    typedef struct smtpSink 
    {
       void * pOpaqueData;
       void (*bdat)(smtpSink_t * in_psmtpSink, int in_responseCode, const char * in_responseMessage) ;
       void (*connect)( smtpSink_t * in_psmtpSink, int in_responseCode, const char * in_responseMessage ) ;
       void (*data)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
       void (*ehlo)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_serverExtension );
       void (*ehloComplete)(smtpSink_t * in_psmtpSink );
       void (*expand)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_emailAddress );
        void (*error)( SMTPSinkPtr_t in_psmtpSink, 
             int in_responseCode, 
             const char * in_errorMessage );
       void (*expand)( SMTPSinkPtr_t in_psmtpSink, 
             int in_responseCode, 
             const char * in_emailAddress );
       void (*expandComplete)(smtpSink_t * in_psmtpSink);
       void (*help)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_helpMessage );
       void (*helpComplete)(smtpSink_t * in_psmtpSink );
       void (*mailFrom)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
       void (*noop)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
       void (*quit)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
       void (*rcptTo)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
       void (*reset)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
       void (*send)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
       void (*sendCommand)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
       void (*sendCommandComplete)(smtpSink_t * 
             in_psmtpSink );
       void (*verify)( smtpSink_t * in_psmtpSink, 
             int in_responseCode, 
             const char * in_responseMessage );
    }smtpSink_t;

    Could anyone point out what I'm doing wrong?

    Thanks for your help, in advance.

  2. #2
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    I guess the error is in smtp.c where you have your main(), and not in smtp.h. So, show us that piece of code.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    You can't use the typedef'd smtpSink_t within the actual typedef. Replace it with struct smtpSink and it will work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-21-2009, 12:37 AM
  2. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  3. using c++ in c code
    By hannibar in forum C Programming
    Replies: 17
    Last Post: 10-28-2005, 09:09 PM
  4. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

Tags for this Thread