ISO C++ forbids declaration of

This is a discussion on ISO C++ forbids declaration of within the C++ Programming forums, part of the General Programming Boards category; Hi I am in the process of porting an 8 yr old program from a a Linux PC kernal 1.3.45 ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    18

    Question ISO C++ forbids declaration of

    Hi I am in the process of porting an 8 yr old program from a a Linux PC kernal 1.3.45 to a newer PC with RH 7.1. When I recompile the program I get the error

    "ISO C++ forbids declaration of `CommandSetup' with no type."

    I am not sure how to clear this problem, on the old compiler it compiles fine.

    Any assistance would be appreciated
    a sample of the code:

    Code:
    // session.h
    //
    
    #ifndef __SESSION_H__
    #define __SESSION_H__
    
    class CSession
    {
    public:
    virtual int ReserveChannels() = 0;
    virtual int CommandSetup(char *pszResponse = NULL, int nRespLen = 0) = 0;
    
    protected:
    char m_szGateway[MAXINPUT];             // Gateway address
    };
    
    #endif // __SESSION_H__
    Code:
    // dacsiv.h
    //---------------------------------------------------------------------------------
    
    #include "session.h"
    
    
    // CDACSIVSession is the DACS-IV specific implementation of CSession.
    
    class CDACSIVSession : public CSession
    {
    public:
    virtual int ReserveChannels();
    virtual int CommandSetup(char *pszResponse, int nRespLen);
    };
    Code:
    // dacsiv.cpp
    //------------------------------------------------------------------------------
    
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <iostream.h>
    #include <sys/types.h>
    #include "scanini.h"
    #ifndef WIN32
    #include "reserver.h"
    #endif
    #include "asert.h"
    #include "dacsiv.h"
    #include "misc.h"
    
    // The constructor merely references the parameterized CSession constructor.
    
    
    CDACSIVSession::CommandSetup(char *pszResponse, int nRespLen)
    {
    switch (m_nCommand)
    {
    case RTRV_T1:
    return RTRVSetup(pszResponse, nRespLen);
    case CONN_TACC_T1:
    return TACCSetup();
    case OPR_LPBK_T1:
    return LPBKSetup();
    case PROV_T1:
    return PROVT1();
    
    }
    return 0;
    }

  2. #2
    twm
    twm is offline
    root
    Join Date
    Sep 2003
    Posts
    232
    >CDACSIVSession::CommandSetup(char *pszResponse, int nRespLen)
    Should be:
    Code:
    int CDACSIVSession::CommandSetup(char *pszResponse, int nRespLen)
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    18
    That was quick thanks.
    Is this a new format? Why would it work ok in my old compiler?

  4. #4
    twm
    twm is offline
    root
    Join Date
    Sep 2003
    Posts
    232
    >Is this a new format? Why would it work ok in my old compiler?
    Your old compiler probably doesn't know that modern C++ doesn't allow implicit int.
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    18
    Thanks you!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 11:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21