Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » can you help me ?

This thread is locked; no one can reply to it. rss feed Print
can you help me ?
Heinz Schmitz
Member #4,213
January 2004

Hello,

ive now decided to use Mingw32 instead of MSVC.
I've compiled allegro, allegrogl, ode and installed the opegl libs and dlls all successfully.
I've downloaded the carterrain demo (sources) from http://benny.kramekweb.com.
during compiling i get following error message:
C:\MinGW\source\carterrain\src>make
gcc -c main.cpp -o main.o -O3
gcc -c glode.cpp -o glode.o -O3
gcc -c trig.cpp -o trig.o -O3
gcc -c geometry.cpp -o geometry.o -O3
gcc -c intro.cpp -o intro.o -O3
gcc -c car.cpp -o car.o -O3
gcc -c camera.cpp -o camera.o -O3
gcc -c skybox.cpp -o skybox.o -O3
gcc -c splash.cpp -o splash.o -O3
splash.cpp: In function `int setup()':
splash.cpp:92: invalid conversion from `char*(*)(int, int*)' to `void*'
splash.cpp:92: invalid conversion from `char*(*)(int, int*)' to `void*'
splash.cpp:92: invalid conversion from `char*(*)(int, int*)' to `void*'
make: *** [splash.o] Error 1

I think the error lies in this codelines:

static int setup (void)
{
#define RESOLUTION_LIST 4
#define COLOUR_LIST 6
#define ZBUFFER_LIST 8
#define WINDOWED_BOX 9
#define DOUBLEBUFFER_BOX 10
#define BUTTON_OK 11

DIALOG dlg[] = {
/* proc x y w h fg bg key flags d1 d2 dp */
{ d_shadow_box_proc, 0, 0, 320, 200, 0, 0, 0, 0, 0, 0, NULL },
{ d_ctext_proc, 160, 10, 0, 0, 0, 0, 0, 0, 0, 0, (char*)"______________________________" },
{ d_ctext_proc, 160, 8, 0, 0, 0, 0, 0, 0, 0, 0, (char*)"carterrain OpenGL window setup" },
{ d_text_proc, 10, 30, 0, 0, 0, 0, 0, 0, 0, 0, (char*)"Resolution" },
{ d_list_proc, 10, 40, 96, 48, 0, 0, 0, 0, 1, 0, resolution_lister },
{ d_text_proc, 120, 30, 0, 0, 0, 0, 0, 0, 0, 0, (char*)"Colour depth" },
{ d_list_proc, 120, 40, 96, 48, 0, 0, 0, 0, 1, 0, colour_depth_lister },
{ d_text_proc, 10, 104, 96, 48, 0, 0, 0, 0, 0, 0, (char*)"Z-buffer depth" },
{ d_list_proc, 10, 114, 96, 48, 0, 0, 0, 0, 1, 0, zbuffer_depth_lister },
{ d_check_proc, 10, 170, 96, 8, 0, 0, 0, 0, 1, 0, (char*)"Windowed" },
{ d_check_proc, 10, 180, 128, 8, 0, 0, 0,D_SELECTED, 1, 0, (char*)"Double Buffered" },
{ d_button_proc, 220, 150, 96, 18, 0, 0, 0, D_EXIT, 0, 0, (char*)"Ok" },
{ d_button_proc, 220, 174, 96, 18, 0, 0, 0, D_EXIT, 0, 0, (char*)"Exit" },
{ NULL }
};

Can anybody give me a tip ?

Thanks all for your great an fast support !

Evert
Member #794
November 2000
avatar

EDIT: read it again; and I think the problem is different from what I thought at first. Which line is line 92? I'm guessing it's
{ d_list_proc, 10, 40, 96, 48, 0, 0, 0, 0, 1, 0, resolution_lister },
in which case the solution would be to cast resolution_lister to (void *), like so:
{ d_list_proc, 10, 40, 96, 48, 0, 0, 0, 0, 1, 0, (void *)resolution_lister },
You may also want to change the (char *) to (void *), as void * is what is actually the datatype of the dp field in the dialog struct and implicit casts to (void *) are illegal in ISO C++.

Also, you may want to check the forum mockup tagsm, see the mockup is on link above the message box.

Tobias Dammers
Member #2,604
August 2002
avatar

Whenever you get an error message like this, please mark the line indicated as the error (92 in this case).
Anyway, the solution is quite simple here. The dp member of the DIALOG struct is of type void*, not char*(*)(int, int*). This second type (in case you don't know) is a function pointer type, a pointer to a function with return type char* that takes one int and one int* argument. Cast the d_XXX to void* like this:

{(void*)d_shadow_box_proc, 0, 0, 320, 200, 0, 0, 0, 0, 0, 0, NULL },

This should compile just fine.

Oh, and please use code tags. Click "mockup is on" in case you don't know what these are.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Heinz Schmitz
Member #4,213
January 2004

Hi,
Thanks for your help.
Your post helps a little bit.
Now i've get an other error. ???

Can anybody help me again ?

C:\MinGW\source\carterrain\src>make
gcc -c main.cpp -o main.o -O3
gcc -c glode.cpp -o glode.o -O3
gcc -c trig.cpp -o trig.o -O3
gcc -c geometry.cpp -o geometry.o -O3
gcc -c intro.cpp -o intro.o -O3
gcc -c car.cpp -o car.o -O3
gcc -c camera.cpp -o camera.o -O3
gcc -c skybox.cpp -o skybox.o -O3
gcc -c splash.cpp -o splash.o -O3
gcc -c timer.cpp -o timer.o -O3
gcc -c loop.cpp -o loop.o -O3
gcc -c controls.cpp -o controls.o -O3
gcc -c menu.cpp -o menu.o -O3
gcc main.o glode.o trig.o geometry.o intro.o car.o camera.o skybox.o splash.o ti
mer.o loop.o controls.o menu.o -o carterrain.exe -lagl -lalleg -lopengl32 -lglu3
2 -lode -mwindows
main.o(.text+0xab):main.cpp: undefined reference to `__gxx_personality_sj0'
main.o(.text+0xbc5):main.cpp: undefined reference to `operator new[](unsigned)'
main.o(.text+0xbdb):main.cpp: undefined reference to `operator new[](unsigned)'
main.o(.text+0x1301):main.cpp: undefined reference to `__gxx_personality_sj0'
main.o(.text$_ZN7CCameraC1Ev+0x1b):main.cpp: undefined reference to `__gxx_perso
nality_sj0'
geometry.o(.text+0x1b):geometry.cpp: undefined reference to `__gxx_personality_s
j0'
geometry.o(.text+0x59):geometry.cpp: undefined reference to `operator new[](unsi
gned)'
geometry.o(.text+0x8b):geometry.cpp: undefined reference to `operator new[](unsi
gned)'
geometry.o(.text+0xa8):geometry.cpp: undefined reference to `operator new[](unsi
gned)'
geometry.o(.text+0x1ac):geometry.cpp: undefined reference to `operator delete[](
void*)'
geometry.o(.text+0x27b):geometry.cpp: undefined reference to `__gxx_personality_
sj0'
geometry.o(.text+0x2b9):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x2eb):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x308):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x40c):geometry.cpp: undefined reference to `operator delete[](
void*)'
geometry.o(.text+0x4db):geometry.cpp: undefined reference to `__gxx_personality_
sj0'
geometry.o(.text+0x521):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x5af):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x5cc):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x6d7):geometry.cpp: undefined reference to `operator delete[](
void*)'
geometry.o(.text+0x79b):geometry.cpp: undefined reference to `__gxx_personality_
sj0'
geometry.o(.text+0x7e1):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x86f):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x88c):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0x997):geometry.cpp: undefined reference to `operator delete[](
void*)'
geometry.o(.text+0xa6e):geometry.cpp: undefined reference to `__gxx_personality_
sj0'
geometry.o(.text+0xaf7):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0xb81):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0xb9e):geometry.cpp: undefined reference to `operator new[](uns
igned)'
geometry.o(.text+0xf4a):geometry.cpp: undefined reference to `operator delete[](
void*)'
geometry.o(.text+0x101e):geometry.cpp: undefined reference to `__gxx_personality
_sj0'
geometry.o(.text+0x10a7):geometry.cpp: undefined reference to `operator new[](un
signed)'
geometry.o(.text+0x1131):geometry.cpp: undefined reference to `operator new[](un
signed)'
geometry.o(.text+0x114e):geometry.cpp: undefined reference to `operator new[](un
signed)'
geometry.o(.text+0x14fa):geometry.cpp: undefined reference to `operator delete[]
(void*)'
geometry.o(.text+0x15fb):geometry.cpp: undefined reference to `operator delete[]
(void*)'
geometry.o(.text+0x1658):geometry.cpp: undefined reference to `operator delete[]
(void*)'
geometry.o(.text+0x16bb):geometry.cpp: undefined reference to `operator delete[]
(void*)'
geometry.o(.text+0x1718):geometry.cpp: undefined reference to `operator delete[]
(void*)'
geometry.o(.text+0x1a7a):geometry.cpp: undefined reference to `__gxx_personality
_sj0'
geometry.o(.text+0x1648):geometry.cpp: undefined reference to `operator delete[]
(void*)'
geometry.o(.text+0x1708):geometry.cpp: undefined reference to `operator delete[]
(void*)'
camera.o(.text+0x204):camera.cpp: undefined reference to `__gxx_personality_sj0'

loop.o(.text+0x3b):loop.cpp: undefined reference to `__gxx_personality_sj0'
loop.o(.text+0x95):loop.cpp: undefined reference to `operator new[](unsigned)'
loop.o(.text+0x23a):loop.cpp: undefined reference to `operator delete[](void*)'
loop.o(.text+0x28b):loop.cpp: undefined reference to `__gxx_personality_sj0'
loop.o(.text+0x2e5):loop.cpp: undefined reference to `operator new[](unsigned)'
loop.o(.text+0x48a):loop.cpp: undefined reference to `operator delete[](void*)'
loop.o(.text+0x4ed):loop.cpp: undefined reference to `operator delete[](void*)'
loop.o(.text+0x53d):loop.cpp: undefined reference to `operator delete[](void*)'
c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/../../../libode.a(collision_kernel.o)(
.data$_ZTV6dxGeom+0x10):collision_kernel.cpp: undefined reference to `__cxa_pure
_virtual'
c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/../../../libode.a(collision_space.o)(.
data$_ZTV7dxSpace+0x28):collision_space.cpp: undefined reference to `__cxa_pure_
virtual'
c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/../../../libode.a(collision_space.o)(.
data$_ZTV7dxSpace+0x2c):collision_space.cpp: undefined reference to `__cxa_pure_
virtual'
c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/../../../libode.a(collision_space.o)(.
data$_ZTV7dxSpace+0x30):collision_space.cpp: undefined reference to `__cxa_pure_
virtual'
make: *** [carterrain.exe] Error 1

????????????

Tobias Dammers
Member #2,604
August 2002
avatar

use g++, not gcc.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Heinz Schmitz
Member #4,213
January 2004

Hi,
thanks for your help.
I've changed it to g++ and now the compiling works. But the created *.exe file creates an error. hmmm. the original *.exe file works.

hmm. I think the only one who can help me here is the coder of these demo ?

Evert
Member #794
November 2000
avatar

Quote:

use g++, not gcc.

Or link with libstdc++.a (ie, inlude -lstdc++ on the command line).

Quote:

But the created *.exe file creates an error.

What error?

EDIT: Tobias, maybe we should posting at the same time? ;D

Tobias Dammers
Member #2,604
August 2002
avatar

Guess so.

You could give me a bit of detail on the error the exe creates. Does it crash on launch? Crash while running? Freeze? Reboot? GPF? Cause obscure behaviour in other apps / the os? If so, how? Throw error messages at you? If so, what are they? Can you manually shut down the exe (Alt-F4)? Kill it (via Ctrl-Alt-Del)?

And what's your system? compiler? allegro version?

Do the allegro examples compile & execute well?

Oh wait: Have you recompiled allegro and allegrogl? If not, please do so.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Heinz Schmitz
Member #4,213
January 2004

Hi,

now it works !;)
The exe file was in the wrong directory

Thanks all !

Tobias Dammers
Member #2,604
August 2002
avatar

Quote:

EDIT: Tobias, maybe we should posting at the same time?

Hehe... we zitten dus in dezelfde tijdzone... GMT+1:00 (Amsterdam)...

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Evert
Member #794
November 2000
avatar

Tobias: He, grappig! Dat had ik nog niet gezien. Alleen staat in je profiel dat Den Haag op de Antillen ligt ;)

gnolam
Member #2,030
March 2002
avatar

Maybe he felt homesick and built his own tropical version of the Hague over there? ;)

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Peter Hull
Member #1,136
March 2001

Heinz,
Next time you post, can you:
Specify a more descriptive title
Use the mockup tags
Just list a few errors if there are lots all very similar
Say why it doesn't work or do what you expected.

Then it will be easier to help you!

Cheers
Pete

Tobias Dammers
Member #2,604
August 2002
avatar

Quote:

Tobias: He, grappig! Dat had ik nog niet gezien. Alleen staat in je profiel dat Den Haag op de Antillen ligt

hehe... typo, seekah weetah denkik.
Or do you call that a "clicko", when you mis-click?

Quote:

Maybe he felt homesick...

No, not homesick. I'm from Germany originally. But I could use a bit more Antillian weather over here right now...

Quote:

...and built his own tropical version of the Hague over there?

Working on it... at least as far as music goes...
click here for aural sunshine: [URL http://www.home.deds.nl/~tdammers/audio/bilongo.mp3]
And before anyone starts nit-picking: Yes that song's from Cuba, yes Cuba is part of the Antilles, no Cuba is not part of the Netherlands Antilles.

Anyway, I could go and change it... but then it's kinda funny, so I'll leave it this way for a while...

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Evert
Member #794
November 2000
avatar

Quote:

hehe... typo, seekah weetah denkik.

:D

Quote:

Or do you call that a "clicko", when you mis-click?

Probably not. A while back, Matthew updated the timezone code and then everyone in the Netherlands was shifted to the Netherlands Antilles. Must have been the largest and fastest mass-emmigration ever.
Not sure if it affected others too though.

Tobias Dammers
Member #2,604
August 2002
avatar

Well, I live close to the sea anyway, so might as well call it the Caribbean, and consider Frans Bauer a samba artist...

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Evert
Member #794
November 2000
avatar

Quote:

might as well call it the Caribbean, and consider Frans Bauer a samba artist...

You have a vivid imaginiation.
;)

Go to: