Linux g ++ about warning: Extra tokens at end of # endif direve ve

Source: Internet
Author: User

Original file timesynmanager. h

 

# Ifndef timesynmanager_h __
# Define timesynmanager_h __

Const int max_year = 1100;
Const int min_year = 70;
Typedef long _ int64;

# Include <time. h>
# Include <stdio. h>
# Include <string. h>
# Include <stdlib. h>
# Include <assert. h>
// # Include <atltime. h>

Typedef/* _ time64_t */time_t utc_time_t;
Typedef struct TM utc_tm;
// Typedef class ctimespan cutctimespan;

Class timesynmanager;

Class ctmparser
{
Public:
Enum e_type
{
E_type_a = 1, // "YY-mm-dd TT: UU: SS" ex.2009-02-10 14:03:00"
E_type_ B, // "mm DD YY hh: mm: SS" ex. May 7 2009 14:36:15"
E_type_c, // "string" ex.123456789
E_type_d, // "week Month day hour: minute: Second Year" ex. Fri May 08 13:29:56 2009
E_type_default = e_type_c
};

Enum e_out_type
{
E_out_a = 1, // "YY-mm-dd TT: UU: SS" ex.2009-02-10 14:03:00"
E_out_ B, // "mm DD YY hh: mm: SS" ex. May 7 2009 14:36:15"
E_out_c, // "string" ex.123456789
E_out_d, // "week Month day hour: minute: Second Year" ex. Fri May 08 13:29:56 2009
E_out_default = e_out_c
};

Enum month_short
{
Jan = 1,
Feb,
Mar,
Apr,
May,
Jun,
Jul,
Aug,
SEP,
Oct,
Nov,
Dec
};

Public:
Ctmparser (const char * parsetm, e_type TP = e_type_default );
Ctmparser (struct TM * newtime, e_out_type TP = e_out_default );
~ Ctmparser (void );
 
PRIVATE:
Utc_tm & Parse ();
Void parseatype ();
Void parsebtype ();
Void parsectype ();
Void parsedtype ();
Void parsemonthshort (char * month );
Void exemoth ();
Bool isnum (char * para );
Bool ismonthshort (char * month );

Char * output ();
Char * outputatype ();
Char * outputbtype ();
Char * outputctype ();
Char * outputdtype ();

PRIVATE:
Utc_tm m_tmstru;
E_type m_type;
E_out_type m_out_type;
Month_short m_month;
Const char * m_parsesrc;
Struct TM * m_outtime;
Friend class timesynmanager;
};

Class timesynmanager
{
Public:
// (3000-1970)
Const static int s_max_year_lenth = 1030;
Static utc_time_t getcurtimeval ()
{
Return/* _ time64 */time (null); // If the parameter is null, the current time is obtained.
}
Timesynmanager ();
Timesynmanager (utc_time_t tmval );
Timesynmanager (utc_tm & TM );
Timesynmanager (const char * psztime, ctmparser: e_type type );
Timesynmanager (struct TM * newtime, ctmparser: e_out_type type, char * output );
~ Timesynmanager (void );
Bool operator = (timesynmanager & DT );
Bool operator> (timesynmanager & DT );
Bool operator >=( timesynmanager & DT );
Bool operator <(timesynmanager & DT );
Bool operator <= (timesynmanager & DT );
_ Int64 operator-(timesynmanager & DT );
Const char * dumptime (char buff [], int maxlen );
// Timesynmanager add (cutctimespan SP );
Timesynmanager add (_ int64 tmvalinterval );
// Timesynmanager sub (cutctimespan SP );
Timesynmanager sub (_ int64 tmvalinterval );

Public:
Utc_tm m_tmstru;
Utc_time_t m_tmval;
};

# Endif timesynmanager_h __

 

Modified file timesynmanager. h

 

# Ifndef timesynmanager_h __
# Define timesynmanager_h __

Const int max_year = 1100;
Const int min_year = 70;
Typedef long _ int64;

# Include <time. h>
# Include <stdio. h>
# Include <string. h>
# Include <stdlib. h>
# Include <assert. h>
// # Include <atltime. h>

Typedef/* _ time64_t */time_t utc_time_t;
Typedef struct TM utc_tm;
// Typedef class ctimespan cutctimespan;

Class timesynmanager;

Class ctmparser
{
Public:
Enum e_type
{
E_type_a = 1, // "YY-mm-dd TT: UU: SS" ex.2009-02-10 14:03:00"
E_type_ B, // "mm DD YY hh: mm: SS" ex. May 7 2009 14:36:15"
E_type_c, // "string" ex.123456789
E_type_d, // "week Month day hour: minute: Second Year" ex. Fri May 08 13:29:56 2009
E_type_default = e_type_c
};

Enum e_out_type
{
E_out_a = 1, // "YY-mm-dd TT: UU: SS" ex.2009-02-10 14:03:00"
E_out_ B, // "mm DD YY hh: mm: SS" ex. May 7 2009 14:36:15"
E_out_c, // "string" ex.123456789
E_out_d, // "week Month day hour: minute: Second Year" ex. Fri May 08 13:29:56 2009
E_out_default = e_out_c
};

Enum month_short
{
Jan = 1,
Feb,
Mar,
Apr,
May,
Jun,
Jul,
Aug,
SEP,
Oct,
Nov,
Dec
};

Public:
Ctmparser (const char * parsetm, e_type TP = e_type_default );
Ctmparser (struct TM * newtime, e_out_type TP = e_out_default );
~ Ctmparser (void );
 
PRIVATE:
Utc_tm & Parse ();
Void parseatype ();
Void parsebtype ();
Void parsectype ();
Void parsedtype ();
Void parsemonthshort (char * month );
Void exemoth ();
Bool isnum (char * para );
Bool ismonthshort (char * month );

Char * output ();
Char * outputatype ();
Char * outputbtype ();
Char * outputctype ();
Char * outputdtype ();

PRIVATE:
Utc_tm m_tmstru;
E_type m_type;
E_out_type m_out_type;
Month_short m_month;
Const char * m_parsesrc;
Struct TM * m_outtime;
Friend class timesynmanager;
};

Class timesynmanager
{
Public:
// (3000-1970)
Const static int s_max_year_lenth = 1030;
Static utc_time_t getcurtimeval ()
{
Return/* _ time64 */time (null); // If the parameter is null, the current time is obtained.
}
Timesynmanager ();
Timesynmanager (utc_time_t tmval );
Timesynmanager (utc_tm & TM );
Timesynmanager (const char * psztime, ctmparser: e_type type );
Timesynmanager (struct TM * newtime, ctmparser: e_out_type type, char * output );
~ Timesynmanager (void );
Bool operator = (timesynmanager & DT );
Bool operator> (timesynmanager & DT );
Bool operator >=( timesynmanager & DT );
Bool operator <(timesynmanager & DT );
Bool operator <= (timesynmanager & DT );
_ Int64 operator-(timesynmanager & DT );
Const char * dumptime (char buff [], int maxlen );
// Timesynmanager add (cutctimespan SP );
Timesynmanager add (_ int64 tmvalinterval );
// Timesynmanager sub (cutctimespan SP );
Timesynmanager sub (_ int64 tmvalinterval );

Public:
Utc_tm m_tmstru;
Utc_time_t m_tmval;
};

# Endif // timesynmanager_h __

Haha, in fact, I changed the last line and commented out my life.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.