简体   繁体   English

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

[英]newer gcc gives illegal syntax error in a header file

I've installed the mimetic library according to the INSTALL instructions. 我已经按照INSTALL指示安装了模拟库。 the following main file compiles without a problem with a gcc-c++ 4.1.2 , but when I upgrade to gcc-c++ 4.4.7 I get an error. 以下主文件可以使用gcc-c++ 4.1.2顺利gcc-c++ 4.4.7 ,但是升级到gcc-c++ 4.4.7出现错误。

mimetic.cpp: mimetic.cpp:

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

using namespace std;
using namespace mimetic;

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

error 错误

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’

the header file: rfc822/messageid.h 头文件: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

is there some compatibility switch for the gcc ? gcc是否有一些兼容性开关?

因此,问题出在系统的配置不​​正确,导致HAVE_STDINT_H未被配置,因此未定义uint32_t ,并发生了错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM