Hello I have an error compiling this code :
int RomInSet (const struct GameDriver *gamedrv, const char* hash) { const struct RomModule *region, *rom; region = rom_first_region(gamedrv); //__RC à supprimer for (region = rom_first_region(gamedrv); region; region = rom_next_region(region)) for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) /* Compare all the available checksums */ if (hash_data_is_equal(ROM_GETHASHDATA(rom), hash, 0)) return 1; return 0; }
the error is :
HardPinMameSrc\audit.c(85): error: #167: argument of type "const struct GameDriver *" is incompatible with parameter of type "const struct GameDriver *" HardPinMameSrc\audit.c: region = rom_first_region(gamedrv); //__RC à supprimer HardPinMameSrc\audit.c: ^ HardPinMameSrc\audit.c(86): error: #167: argument of type "const struct GameDriver *" is incompatible with parameter of type "const struct GameDriver *" HardPinMameSrc\audit.c: for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
this code compile without error with visual c++. can you help me ?
thanks
best regards Renaud
can you help me ?
Nobody can, because your description of the problem is critically incomplete.
Where is the definition of struct GameDriver supposed to be? Which lines of your out-of-context snippet are 85 and 86? Where is the declaration of rom_first_region?
Your problem most likely has nothing to do with C++, nor MSVC. It is that the definition of that struct was not visible at the point that snippet was compiled.
Oh, and could you really not think of any better title for your post than "Compilation problem"? That would match about half the entire topic range of this forum!
Hello,
Sorry for the imprecision, i'm a beginner..
here's the code :
00 #include "driver.h" 01 #include <stdarg.h> 02 #include <string.h> 03 #include "audit.h" 04 #include "harddisk.h" 05 #include "common.h" . . . 82 int RomInSet (const struct GameDriver *gamedrv, const char* hash) 83 { 84 const struct RomModule *region, *rom; 85 region = rom_first_region(gamedrv); //__RC à supprimer 86 for (region = rom_first_region(gamedrv); region; region = rom_next_region(region)) 87 for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) 88 /* Compare all the available checksums */ 89 if (hash_data_is_equal(ROM_GETHASHDATA(rom), hash, 0)) 90 return 1; 91 92 return 0; 93}
The structs defs : (in "common.h")
/* ROM processing */ int rom_load(const struct RomModule *romp); const struct RomModule *rom_first_region(const struct GameDriver *drv); const struct RomModule *rom_next_region(const struct RomModule *romp); const struct RomModule *rom_first_file(const struct RomModule *romp); const struct RomModule *rom_next_file(const struct RomModule *romp); const struct RomModule *rom_first_chunk(const struct RomModule *romp); const struct RomModule *rom_next_chunk(const struct RomModule *romp); void printromlist(const struct RomModule *romp,const char *name);
from "driver.h"
struct GameDriver { const char *source_file; /* set this to __FILE__ */ const struct GameDriver *clone_of; /* if this is a clone, point to */ /* the main version of the game */ const char *name; const struct SystemBios *bios; /* if this system has alternate bios roms use this */ /* structure to list names and ROM_BIOSFLAGS. */ const char *description; const char *year; const char *manufacturer; void (*drv)(struct InternalMachineDriver *); const struct InputPortTiny *input_ports; void (*driver_init)(void); /* optional function to be called during initialization */ /* This is called ONCE, unlike Machine->init_machine */ /* which is called every time the game is reset. */ const struct RomModule *rom; #ifdef MESS void (*sysconfig_ctor)(struct SystemConfigurationParamBlock *cfg); const struct GameDriver *compatible_with; #endif UINT32 flags; /* orientation and other flags; see defines below */ };
and the error :
compiling audit.c... HardPinMameSrc\audit.c(85): error: #167: argument of type "const struct GameDriver *" is incompatible with parameter of type "const struct GameDriver *" HardPinMameSrc\audit.c: region = rom_first_region(gamedrv); //__RC à supprimer HardPinMameSrc\audit.c: ^ HardPinMameSrc\audit.c(86): error: #167: argument of type "const struct GameDriver *" is incompatible with parameter of type "const struct GameDriver *" HardPinMameSrc\audit.c: for (region = rom_first_region(gamedrv); region; region = rom_next_region(region)) HardPinMameSrc\audit.c: ^ HardPinMameSrc\audit.c(188): error: #167: argument of type "const struct GameDriver *" is incompatible with parameter of type "const struct GameDriver *" HardPinMameSrc\audit.c: for (region = rom_first_region(gamedrv); region; region = rom_next_region(region)) HardPinMameSrc\audit.c: ^ HardPinMameSrc\audit.c: HardPinMameSrc\audit.c: 0 warnings, 3 errors
I hope that someone can help me...
Renaud
in "common.h"
struct RomModule { const char *_name; /* name of the file to load */ UINT32 _offset; /* offset to load it to */ UINT32 _length; /* length of the file */ UINT32 _flags; /* flags */ const char *_hashdata; /* hashing informations (checksums) */ };
View all questions in Keil forum