Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » invalid conversion from `void*' to "constRGB"

This thread is locked; no one can reply to it. rss feed Print
invalid conversion from `void*' to "constRGB"
zenofeller_
Member #8,364
February 2007

i get these errors when trying to use a variable inited as

   replace_filename(datafile_name, argv[0], "running.dat",
        sizeof(datafile_name));
   running_data = load_datafile(datafile_name);

as a parameter to set_palette

 set_palette(running_data[PALETTE_001].dat);

both the running.h and running.dat are available. going to eat, will be back hunting the buggie. if anybody has a quick comment you'd save me a lot of grief. i have a feeling it's something trivial. thanks.

I, however, am strongly suggesting that you START CAPITALIZING, FUCK IT! (gnolam)

Thomas Fjellstrom
Member #476
June 2000
avatar

Sounds like you're using C++?

set_palette((RGB*)running_data[PALETTE_001].dat);

That should fix it in C and C++, or for C++ only,

set_palette(static_cast<RGB*>(running_data[PALETTE_001].dat));

it may or may not need the "const" before the RGBs.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

zenofeller_
Member #8,364
February 2007

ay! right, allegro is c. thanks :)

I, however, am strongly suggesting that you START CAPITALIZING, FUCK IT! (gnolam)

Go to: