Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

labnotes

Technical User
Sep 1, 2003
33
CA
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:

two header files

// 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__

_______________________________________

// 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);
};

=============================
the. cpp file

// dacsiv.cpp
//------------------------------------------------------------------------------


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream.h>
#include <sys/types.h>
#include &quot;scanini.h&quot;
#ifndef WIN32
#include &quot;reserver.h&quot;
#endif
#include &quot;asert.h&quot;
#include &quot;dacsiv.h&quot;
#include &quot;misc.h&quot;

// 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;
}

 
Error is in this part of code
------------------------------
CDACSIVSession::CommandSetup(char *pszResponse, int nRespLen)
{
switch (m_nCommand)
{
....
}
return 0;
}

It should be
-------------

virtual int CDACSIVSession::CommandSetup(char *pszResponse, int nRespLen)
{
switch (m_nCommand)
{
....
}
return 0;
}

Iso C++ doesn't allow a function with no return type...
Only constructors don't have return type..........
 
Pl. correct this the definition in cpp will be like this
------------------------------
int CDACSIVSession::CommandSetup(char *pszResponse, int nRespLen)
{
switch (m_nCommand)
{
....
}
return 0;
}

Iso C++ doesn't allow a function with no return type...
Only constructors don't have return type..........
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top