在VC ++中编译rtmpd时出错

时间:2009-07-20 12:11:26

标签: visual-c++

我试图使用VS2008编译rtmpd Iam收到此错误。

错误63错误C4430:缺少类型说明符 - 假定为int。注意:C ++不支持default-int \ variant.h 87 lib

我是VC ++的新手,寻求帮助。

代码在这里

#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; 我得到了   这一行出错

        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 */

2 个答案:

答案 0 :(得分:1)

uint32_t和朋友是C99标准中定义的类型。它们受G ++支持,但不支持MSVC ++(没有义务支持它们作为C ++编译器)。您可以输入特定于MS的类型,例如unsigned __int32:

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

,e.t.c。

答案 1 :(得分:1)

服务器能够在win32的几个版本之前运行(参见svn日志),但我不得不削减它以为linux和win32腾出空间。

目前,服务器在win32上无法编译。正如EFraim建议的那样,这些类型在win32上不可用,但您可以轻松定义它们。此外,如果你查看trunk / sources / thelib / platform,你会看到一些目录。 (osx,freebsd等)。选择其中一个并将其复制为win32。之后,开始用代码填补空白。另外在platform.h中包含必要的头文件(你在同一个文件中有osx和freebsd的样本)

如果您遇到任何问题,请告诉我。

Tx表示您对我的项目感兴趣。

祝你好运, 安德烈

P.S。我建议在rtmpd.com上创建一个帐户,并在那里发布任何问题。这可能有所帮助。