1834324 Members
3282 Online
110066 Solutions
New Discussion

Re: aCC Compiler error

 
CRAZY SANTHOSH
Occasional Advisor

aCC Compiler error

Hi all,

I am porting tripwire product on HP-UX and when use aCC Compiler I am getting following error while compilation but compilation is successfull when i use g++ compiler(3.4.3 version)

error is:
aCC -DHAVE_CONFIG_H -I. -I. -I../.. -I.. -O -c -o file_unix.o file_unix.cpp
"../core/errorutil.h", line 140: warning #2340-D: value copied to temporary,
reference to temporary used
: eError( _T("") ),
^

"file_unix.cpp", line 170: error #2334: class "eFileOpen" has no suitable copy
constructor
throw( eFileOpen( sFileName, iFSServices::GetInstance()->GetErrS tring() ) ) ;
^

"file_unix.cpp", line 179: error #2334: class "eFileOpen" has no suitable copy
constructor
throw( eFileOpen( sFileName, iFSServices::GetInstance()- >GetErrString() ) );
^

"file_unix.cpp", line 236: error #2334: class "eInternal" has no suitable copy
constructor
throw( eInternal( _T("file_unix") ) );
^

"file_unix.cpp", line 257: error #2334: class "eFileSeek" has no suitable copy
constructor
throw eFileSeek();
^

"file_unix.cpp", line 281: error #2334: class "eFileRead" has no suitable copy
constructor
throw eFileRead( mpData->mFileName, iFSServices::GetInstance()-> GetErrString() ) ;
^

"file_unix.cpp", line 284: warning #2940-D: missing return statement at end of
non-void function "cFile::Read"
}
^

"file_unix.cpp", line 299: error #2334: class "eFileWrite" has no suitable
copy constructor
throw eFileWrite( mpData->mFileName, iFSServices::GetInstance()- >GetErrString() );
^

"file_unix.cpp", line 302: warning #2940-D: missing return statement at end of
non-void function "cFile::Write"
}
^

"file_unix.cpp", line 321: error #2334: class "eFileFlush" has no suitable
copy constructor
throw eFileFlush( mpData->mFileName, iFSServices::GetInstance()- >GetErrString() );
^

"file_unix.cpp", line 336: error #2334: class "eFileRewind" has no suitable
copy constructor
throw( eFileRewind( mpData->mFileName, iFSServices::GetInstance( )->GetErrString() ) );
^

"file_unix.cpp", line 369: error #2334: class "eFileTrunc" has no suitable
copy constructor
throw( eFileTrunc( mpData->mFileName, iFSServices::GetInstance() ->GetErrString() ) );
^

"file_unix.cpp", line 57: warning #2177-D: function "util_GetErrnoString" was
declared but never referenced
static TSTRING util_GetErrnoString()
^

9 errors detected in the compilation of "file_unix.cpp".


Please help me if any source code modifications has to be done or any compiler options to be provided ...

Suggesions are appreciated...

Thank you in Advance

--Regards
Santhosh
11 REPLIES 11
Steven E. Protter
Exalted Contributor

Re: aCC Compiler error

Shalom,

To recommend source code modifications, someone might actually need to see the source code.

The compiler is telling you what lines to look at. Looks like a code review problem to me.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: aCC Compiler error

>when use aCC Compiler I am getting following error while compilation

g++ is probably not as strict. When you throw, the copy constructor must exist and be accessible. Even if the copy ctor can be optimized out. Error 2330 occurs if not accessible.

To get error 2334 it requires that you have the wrong type of copy ctor, one without const&:
eFileOpen(eFileOpen&);

>Please help me if any source code modifications

Why would you not have const above? Did you want to modify the source? If you need to do that you need to make the field mutable or use a const_cast.
CRAZY SANTHOSH
Occasional Advisor

Re: aCC Compiler error

Hi Dennis,

Thank you for your help...

I am bit confused Dennis ...I am herewith sending file_unix.cpp gile along with this mail...

Please help me in this regard(What needs to be added??? or modified????)

--Regards
Santhosh
Dennis Handly
Acclaimed Contributor

Re: aCC Compiler error

>I am herewith sending file_unix.cpp gile along with this mail.

Typically .cpp files are useless, you don't see the headers. If you compile with -E -.i, you can produce a .i file. Of course you may not want to post it here if there is valuable IP or copyrighted info in it. (Ok, this is GNU GPL.)

>Please help me in this regard (What needs to be added??? or modified????)

I need the header that declares the copy ctor for eFileOpen. As I said, you probably have:
eFileOpen(eFileOpen&) and you should have
eFileOpen(const eFileOpen&)
CRAZY SANTHOSH
Occasional Advisor

Re: aCC Compiler error

Hi Dennis,

I tried with that -E option and Generated the intemediate file also and got the constructors ...

I will am sending you the three .h files 1.file.h

Look at this line

(TSS_FILE_EXCEPTION(eFileOpen, eFile );)

2.fileerror.h

Look at this line

#define TSS_FILE_EXCEPTION( except, base ) \
TSS_BEGIN_EXCEPTION( except, base ) \
except( const TSTRING& filename, const TSTRING& msg, uint32 flags = 0 ) \
: base( filename, msg, flags ) {} \
TSS_END_EXCEPTION()

#endif

3.fsservices.h

look at this line
virtual TSTRING GetErrString() const = 0;



CRAZY SANTHOSH
Occasional Advisor

Re: aCC Compiler error

Find fileerror.h file in attached format
CRAZY SANTHOSH
Occasional Advisor

Re: aCC Compiler error

Find fssserrvices.h file in attached format
CRAZY SANTHOSH
Occasional Advisor

Re: aCC Compiler error

Find find the intermediate file in attached format
Dennis Handly
Acclaimed Contributor

Re: aCC Compiler error

>Find fileerror.h file

This shows the problem, a little different than I mentioned:
explicit eFileError(const eFileError& rhs)
: eError(rhs) { mFilename = rhs.mFilename; }

Using "explicit" here causes the copy ctor to be ignored. 12.3.1(2) says that this constructor can only be used where direct initialization is used.
8.5(12) says that throw is a copy-initialization, so that copy constructor isn't considered.
So remove "explicit".
CRAZY SANTHOSH
Occasional Advisor

Re: aCC Compiler error

HI Dennis,

Thank you for the reply and problem got resolved ...

I removed explicit keyword from the .h file and it is working fine ...

Thanks once again for your help ...

--Regards
Santhosh
Dennis Handly
Acclaimed Contributor

Re: aCC Compiler error

>and it is working fine ... thanks once again for your help ...

You have not awarded any points yet. Please read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33