较新的gcc在头文件中出现非法语法错误

时间:2013-08-05 13:23:52

标签: c++ gcc

我已根据INSTALL说明安装了mimetic库。 以下主文件编译时gcc-c++ 4.1.2没有问题, 但是当我升级到gcc-c++ 4.4.7时,我收到了错误。

  

mimetic.cpp:

#include <iostream>
#include <mimetic.h>

using namespace std;
using namespace mimetic;

int main()
{
    MimeEntity me;          
    return 0;
}

错误

In file included from /usr/local/include/mimetic/rfc822/header.h:18,
                 from /usr/local/include/mimetic/header.h:11,
                 from /usr/local/include/mimetic/mimetic.h:18,
                 from mimetic.cpp:2:
/usr/local/include/mimetic/rfc822/messageid.h:29: error: expected ‘)’ before ‘thread_id’

头文件: RFC822 / messageid.h

#ifndef _MIMETIC_MESSAGEID_H_
#define _MIMETIC_MESSAGEID_H_
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <string>
#include <mimetic/libconfig.h>
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <mimetic/utils.h>
#include <mimetic/os/utils.h>
#include <mimetic/rfc822/fieldvalue.h>

namespace mimetic
{
/// Message-ID field value 
/// On Win32 Winsock library must be initialized before using this class.
struct MessageId: public FieldValue
{
    MessageId(uint32_t thread_id = 0 ); // <------ line 29
    MessageId(const std::string&);
    std::string str() const;
    void set(const std::string&);
protected:
    FieldValue* clone() const;
private:
    static unsigned int ms_sequence_number;
    std::string m_msgid;
};
}
#endif

是否有一些gcc的兼容性开关?

1 个答案:

答案 0 :(得分:3)

因此,问题是系统配置不佳,导致HAVE_STDINT_H未配置,因此uint32_t未定义,并且发生错误。