2010-01-17 5 views
1

Je ne vois pas pourquoi cette erreur arrive. Peut-être que quelqu'un d'autre le voit.types incompatibles lors de l'initialisation type

Voici l'erreur.

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 

Voici le code associé.

#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, ne comprenait pas tout:

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_TYPE_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; 
}; 
+0

fournissent des définitions des struct VisParamEntryProxy et VisParamEntryLimitType –

+0

Alors qu'est-ce qu'un VisParamEntryProxy? –

+0

Demandez à votre compilateur de générer la sortie prétraite. Ensuite, vous devriez être en mesure d'avoir une idée plus claire de ce qui se passe après toute la substitution macro folle. – jamesdlin

Répondre

2

Il y a pas de définition pour le type VisParamEntryProxy. Mais, en supposant que c'était une erreur de transcription ici, je pense que l'erreur est causée par des macros fournissant seulement 5 ou 6 initialiseurs, quand la structure a besoin de 7.

Ou, si je me suis trompé la chaîne de caractères, alors il faut seulement 6 valeurs. Pour ce dernier, vous avez ceci:

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

Mais je pense que ce doit être quelque chose comme

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

Ouais la couleur était le problème. Je l'ai déplacé à la dernière position et cela fonctionne maintenant. Merci! – Scott

Questions connexes