Stasv
Stasv

Reputation: 115

newer gcc gives illegal syntax error in a header file

I've installed the mimetic library according to the INSTALL instructions. 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.

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

#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 ?

Upvotes: 2

Views: 704

Answers (1)

Mats Petersson
Mats Petersson

Reputation: 129454

So, the problem turns out to be poor configuration of the system, which leaves HAVE_STDINT_H not configured, and thus the uint32_t doesn't get defined, and the error occurs.

Upvotes: 3

Related Questions