martinbriefcase@hotmail.com wrote:[color=blue]
> I cleaned all the object files and rebuilt again and this time i got
> different errors. The following code is the fragement of the whole
> AmmUtils.h file and can anyone be kind to tell me what's wrong with my
> code?
>
> Error 13 error C2062: type 'int'
> unexpected c:\working\qommessage\qommessage\ammutils.h 14
> Error 14 error C2334: unexpected token(s) preceding '{'; skipping
> apparent function body c:\working\qommessage\qommessage\ammutils.h 14
> Error 15 error C2146: syntax error : missing ';' before identifier
> 'errMsg' c:\working\qommessage\qommessage\ammutils.h 31
> Error 16 error C4430: missing type specifier - int assumed. Note: C++
> does not support
> default-int c:\working\qommessage\qommessage\ammutils.h 31
>
>
> #ifndef __AMM_UTILS__
> #define __AMM_UTILS__
>
> #include <string>
> #include <ace/Synch.h>
> #include <tibrv/tibrvcpp.h>
>
> //namespace AMM
> //{
>
> class AMMException
> {
> public:
> AMMException(int pErrCode = 0, string pErrMsg = "")
> {
> mErrCode = pErrCode;
> mErrMsg = pErrMsg;
> }
> virtual ~AMMException()
> {
> }
> AMMException(const AMMException& that)
> {
> mErrCode = that.mErrCode;
> mErrMsg = that.mErrMsg;
> }
> int errCode() const
> {
> return mErrCode;
> }
> string errMsg() const
> {
> return mErrMsg;
> }
>
> private:
> int mErrCode;
> string mErrMsg;
> };
> .
> .
> .
> #endif[/color]
Methinks you are probably lacking namespace qualification of
std::string (unless one of those other headers nastily puts a using
declaration in the header). Change each appearance of string to
std::string, or make a private alias, e.g.:
class A
{
typedef std::string string;
public:
A( const string& s );
};
Cheers! --M