tags:

views:

317

answers:

2

Hi All,

Iam trying to compile rtmpd using VS2008 Iam getting this error.

Error 63 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int \variant.h 87 lib

Iam a newbie to VC++, looking for help.

code is here

#ifndef _VARIANT_H
#define _VARIANT_H



#include "utils/core.h"

#ifdef LOG_VARIANT_MEMORY_MANAGEMENT
#define CONSTRUCTOR  FINEST(" +  %d->%d",_constructorCount,_constructorCount+1); _constructorCount++;
#define DESTRUCTOR   FINEST(" -  %d->%d",_constructorCount,_constructorCount-1); _constructorCount--;
#define DYNAMIC_ALLOC   FINEST("(+) %d->%d",_dynamicAllocationCount,_dynamicAllocationCount+1); _dynamicAllocationCount++;
#define DYNAMIC_FREE    FINEST("(-) %d->%d",_dynamicAllocationCount,_dynamicAllocationCount-1); _dynamicAllocationCount--;
#else
#define CONSTRUCTOR
#define DESTRUCTOR
#define DYNAMIC_ALLOC
#define DYNAMIC_FREE
#endif

typedef enum _VariantType {
    V_NULL = VAR_ENUM_VALUE_NULL,
    V_UNDEFINED = VAR_ENUM_VALUE_UNDEFINED,
    V_BOOL = VAR_ENUM_VALUE_BOOL,
    V_INT8 = VAR_ENUM_VALUE_INT8,
    V_INT16 = VAR_ENUM_VALUE_INT16,
    V_INT32 = VAR_ENUM_VALUE_INT32,
    V_INT64 = VAR_ENUM_VALUE_INT64,
    V_UINT8 = VAR_ENUM_VALUE_UINT8,
    V_UINT16 = VAR_ENUM_VALUE_UINT16,
    V_UINT32 = VAR_ENUM_VALUE_UINT32,
    V_UINT64 = VAR_ENUM_VALUE_UINT64,
    V_DOUBLE = VAR_ENUM_VALUE_DOUBLE,
    _V_NUMERIC = VAR_ENUM_VALUE_NUMERIC,
    V_TIMESTAMP = VAR_ENUM_VALUE_TIMESTAMP,
    V_DATE = VAR_ENUM_VALUE_DATE,
    V_TIME = VAR_ENUM_VALUE_TIME,
    V_STRING = VAR_ENUM_VALUE_STRING,
    V_NAMED_MAP = VAR_ENUM_VALUE_NAMED_MAP,
    V_MAP = VAR_ENUM_VALUE_MAP
} VariantType;

struct VariantMap;

#define Timestamp struct tm

class Variant {
private:
    VariantType _type;

    union {
        bool b;
        int8_t i8;
        int16_t i16;
        int32_t i32;
        int64_t i64;
        uint8_t ui8;
        uint16_t ui16;

uint32_t ui32; Iam getting Error in this line

        uint64_t ui64;
        double d;
        Timestamp *t;
        string *s;
        VariantMap *m;
    } _value;
#ifdef LOG_VARIANT_MEMORY_MANAGEMENT
    static int _constructorCount;
    static int _dynamicAllocationCount;
#endif
public:
    Variant();
    Variant(const Variant &val);

    Variant(const bool &val);
    Variant(const int8_t &val);
    Variant(const int16_t &val);
    Variant(const int32_t &val);
    Variant(const int64_t &val);
    Variant(const uint8_t &val);
    Variant(const uint16_t &val);
    Variant(const uint32_t &val);
    Variant(const uint64_t &val);
    Variant(const double &val);

    Variant(const Timestamp &time);
    Variant(const uint16_t year, const uint8_t month, const uint8_t day);
    Variant(const uint8_t hour, const uint8_t min, const uint8_t sec, const uint16_t m);
    Variant(const uint16_t year, const uint8_t month, const uint8_t day,
            const uint8_t hour, const uint8_t min, const uint8_t sec, const uint16_t m);

    Variant(const char *pValue);
    Variant(const string &value);

    Variant(const string &key, const Variant &value);
    Variant(const string &typeName, const string &key, const Variant &value);

    virtual ~Variant();

    void Reset();
    string ToString(string name = "", uint32_t indent = 0);

    Variant & operator=(const Variant &val);
    Variant & operator=(const bool &val);
    Variant & operator=(const int8_t &val);
    Variant & operator=(const int16_t &val);
    Variant & operator=(const int32_t &val);
    Variant & operator=(const int64_t &val);
    Variant & operator=(const uint8_t &val);
    Variant & operator=(const uint16_t &val);
    Variant & operator=(const uint32_t &val);
    Variant & operator=(const uint64_t &val);
    Variant & operator=(const double &val);

    Variant & operator=(const Timestamp &val);

    Variant & operator=(const char *pVal);
    Variant & operator=(const string &val);

    operator VariantType();
    operator bool();
    operator int8_t();
    operator int16_t();
    operator int32_t();
    operator int64_t();
    operator uint8_t();
    operator uint16_t();
    operator uint32_t();
    operator uint64_t();
    operator double();
    operator Timestamp();
    operator string();

    Variant & operator[](const string &key);
    Variant & operator[](const char *key);
    Variant & operator[](const double &key);
    Variant & operator[](const uint32_t &key);
    Variant & operator[](Variant &key);

    bool operator==(Variant variant);
    bool operator!=(Variant variant);
    bool operator==(VariantType type);
    bool operator!=(VariantType type);

    string GetMapName();
    void SetMapName(string name);
    bool HasKey(const string &key);
    void RemoveKey(const string &key);
    void RemoveAt(const uint32_t index);
    void RemoveAllKeys();
    uint32_t MapSize();
    void PushToArray(Variant value);

    map<string, Variant>::iterator begin();
    map<string, Variant>::iterator end();

    bool IsTimestamp();
    bool IsNumeric();
    bool IsArray();
    void IsArray(bool isArray);
    bool ConvertToTimestamp();

    static bool Deserialize(string &data, Variant &variant);
    string Serialize();
};


#endif  /* _VARIANT_H */
A: 

uint32_t and friend are types defined in C99 standard. They are supported by G++ but not MSVC++ (which is not obliged to support them as C++ compiler). You can typedef MS-specific types such as unsigned __int32:

typedef unsigned __int32 uint32_t; typedef __int32 int32_t; typedef unsigned __int8 uint8_t;

, e.t.c.

EFraim
+1  A: 

Hello,

The server was able to run in win32 few versions ago (see the svn logs) but I had to cut it to make room for linux AND win32.

Right now, the server is not compilable on win32. As EFraim suggested, those types are not available on win32 but you can define them easily. Moreover, if you look in trunk/sources/thelib/platform you will see some directories. (osx, freebsd, etc). Pick one of them and copy it as win32. After that, start filling the gaps with code. Also in platform.h include the necessary header files (you have samples for osx and freebsd in the same file)

Let me know if you encounter any problems.

Tx for your interest in my project.

Best regards, Andrei

P.S. I suggest to also create an account on rtmpd.com and post any questions there too. It might help.

shiretu
hey , thanks for the elaborate answer, just registered for your project. So what do you suggest, should I use typedefs to compile the code.
Sumit Ghosh