开发者

incompatible types when initializing type

I don't see why this error is coming up. Maybe someone else sees it.

Here's the error.

actor_plazma.c:92: error: incompatible types when initializing type ‘int (*)(struct VisObject *)’ using type ‘float’
actor_plazma.c:92: error: incompatible types when initializing type ‘void *’ using type ‘float’
make: *** [actor_plazma.lo] Error 1

Here's the related code.

#define VISUAL_PARAM_LIST_ENTRY_FLOAT(name, val, lim)       { name, VISUAL_PARAM_ENTRY_TYPE_FLOAT, 0, val, lim }


#define VISUAL_PARAM_LIMIT_FLOAT(min, max)          { VISUAL_PARAM_ENTRY_LIMIT_TYPE_FLOAT, 0, min, 0, 0, max, 0 }

typedef enum {
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_NULL,
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_INTEGER,
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_FLOAT,
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_DOUBLE,
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_END
} VisParamEntryLimitType;

static VisParamEntryProxy params[] = {
    VISUAL_PARAM_LIST_ENTRY_INTEGER ("bass sensitivity",    0,  VISUAL_PARAM_LIMIT_NONE),
    VISUAL_PARAM_LIST_ENTRY_INTEGER ("plazma effect",   TRUE,   VISUAL_PARAM_LIMIT_BOOLEAN),
    VISUAL_PARAM_LIST_ENTRY_INTEGER ("3d effect option",    FALSE,  VISUAL_PARAM_LIMIT_BOOLEAN),
    VISUAL_PARAM_LIST_ENTRY_INTEGER ("lines",       TRUE,   VISUAL_PARAM_LIMIT_BOOLEAN),
    VISUAL_PARAM_LIST_ENTRY_INTEGER ("spectrum",        TRUE,   VISUAL_PARAM_LIMIT_BOOLEAN),
    VISUAL_PARAM_LIST_ENTRY_INTEGER ("3d effect",       TRUE,   VISUAL_PARAM_LIMIT_BOOLEAN),
    VISUAL_PARAM_LIST_ENTRY_FLOAT   ("rotation speed",  0.4,    VISUAL_PARAM_LIMIT_FLOAT(0.0f, 1000.0f)), // line 92
    VISUAL_PARAM_LIST_END
};

Edit: Oops, didn't include everything:

typedef enum {
    VISUAL_PARAM_ENTRY_TYPE_NULL,       /**< No parameter. */
    VISUAL_PARAM_ENTRY_TYPE_STRING,     /**< String parameter. */
    VISUAL_PARAM_ENTRY_TYPE_INTEGER,    /**< Integer parameter. */
    VISUAL_PARAM_ENTRY_TYPE_FLOAT,      /**< Floating point parameter. */
    VISUAL_PARAM_ENTRY_TYP开发者_Go百科E_DOUBLE,     /**< Double floating point parameter. */
    VISUAL_PARAM_ENTRY_TYPE_COLOR,      /**< VisColor parameter. */
    VISUAL_PARAM_ENTRY_TYPE_PALETTE,    /**< VisPalette parameter. */
    VISUAL_PARAM_ENTRY_TYPE_OBJECT,     /**< VisObject parameter. */
    VISUAL_PARAM_ENTRY_TYPE_END     /**< List end, and used as terminator for VisParamEntry lists. */
} VisParamEntryType;

typedef enum {
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_NULL,
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_INTEGER,
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_FLOAT,
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_DOUBLE,
    VISUAL_PARAM_ENTRY_LIMIT_TYPE_END
} VisParamEntryLimitType;

struct _VisParamEntryLimitProxy {
    VisParamEntryLimitType  type;

    struct {
        int      integer;       /**< Integer data. */
        float        floating;      /**< Floating point data. */
        double       doubleflt;     /**< Double floating point data. */
    } min;

    struct {
        int      integer;       /**< Integer data. */
        float        floating;      /**< Floating point data. */
        double       doubleflt;     /**< Double floating point data. */
    } max;
};

struct _VisParamEntryProxy {
    const char      *name;

    VisParamEntryType    type;

    char            *string;
    double           value;

    VisColor         color;

    VisParamEntryLimitProxy  limit;
};


There's no definition for type VisParamEntryProxy. But, assuming that was a transcription error to here, I think the error is caused by macros only providing 5 or 6 initializers, when the structure needs 7.

Or, if I've mistaken the type chain, then it needs only 6 values. For the latter, you have this:

#define VISUAL_PARAM_LIST_ENTRY_FLOAT(name, val, lim) { name, VISUAL_PARAM_ENTRY_TYPE_FLOAT, 0, val, lim }

But I think it needs to be something like

#define VISUAL_PARAM_LIST_ENTRY_FLOAT(name, val, lim) { name, VISUAL_PARAM_ENTRY_TYPE_FLOAT, 0, val, SOMECOLOR, lim}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜