Error with allegro please help ..
Adix88

hey , i`m building a game using allegro library but i get the following error message .. do u know what might be the problem ?

1Compiler: Default compiler
2Building Makefile: "M:\Cars\Makefile.win"
3Executing make...
4make.exe -f "M:\Cars\Makefile.win" all
5g++.exe -D__DEBUG__ -c game.cpp -o game.o -I"M:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"M:/Dev-Cpp/include/c++/3.4.2/backward" -I"M:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"M:/Dev-Cpp/include/c++/3.4.2" -I"M:/Dev-Cpp/include" -DALLEGRO_STATICLINK -g3
6 
7In file included from game.cpp:2:
8cars.cpp: In member function `void car::Desenbuf()':
9cars.cpp:17: warning: passing `float' for converting 3 of `void rotate_sprite(BITMAP*, BITMAP*, int, int, fixed)'
10cars.cpp:17: warning: passing `float' for converting 4 of `void rotate_sprite(BITMAP*, BITMAP*, int, int, fixed)'
11
12g++.exe -D__DEBUG__ -c cars.cpp -o cars.o -I"M:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"M:/Dev-Cpp/include/c++/3.4.2/backward" -I"M:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"M:/Dev-Cpp/include/c++/3.4.2" -I"M:/Dev-Cpp/include" -DALLEGRO_STATICLINK -g3
13
14cars.cpp: In member function `void car::Desenbuf()':
15cars.cpp:17: warning: passing `float' for converting 3 of `void rotate_sprite(BITMAP*, BITMAP*, int, int, fixed)'
16cars.cpp:17: warning: passing `float' for converting 4 of `void rotate_sprite(BITMAP*, BITMAP*, int, int, fixed)'
17 
18g++.exe -D__DEBUG__ main.o game.o cars.o -o "Cars.exe" -L"M:/Dev-Cpp/lib" -mwindows -lalleg_s -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 -ldinput -lddraw -ldxguid -lwinmm -ldsound -g3
19 
20game.o(.text+0x0): In function `ZN3car4LoadEPc':
21M:/Cars/cars.cpp:7: multiple definition of `car::Load(char*)'
22main.o(.text+0x0):M:/Cars/cars.cpp:7: first defined here
23game.o(.text+0xa2): In function `ZN3car8DesenbufEv':
24M:/Cars/cars.cpp:16: multiple definition of `car::Desenbuf()'
25main.o(.text+0x6):M:/Cars/cars.cpp:16: first defined here
26game.o(.text+0x1a8): In function `Z5Tastev':
27M:/Cars/game.cpp:6: multiple definition of `Taste()'
28main.o(.text+0x10c):M:/Cars/game.cpp:6: first defined here
29game.o(.text+0x278): In function `Z8Desenarev':
30M:/Cars/game.cpp:14: multiple definition of `Desenare()'
31main.o(.text+0x1dc):M:/Cars/game.cpp:14: first defined here
32game.o(.text+0x308): In function `Z6Sunetev':
33M:/Cars/game.cpp:18: multiple definition of `Sunete()'
34main.o(.text+0x26c):M:/Cars/game.cpp:17: first defined here
35cars.o(.text+0x0): In function `ZN3car4LoadEPc':
36M:/Cars/cars.cpp:7: multiple definition of `car::Load(char*)'
37main.o(.text+0x0):M:/Cars/cars.cpp:7: first defined here
38cars.o(.text+0xa2): In function `ZN3car8DesenbufEv':
39M:/Cars/cars.cpp:16: multiple definition of `car::Desenbuf()'
40main.o(.text+0x6):M:/Cars/cars.cpp:16: first defined here
41collect2: ld returned 1 exit status
42 
43make.exe: *** [Cars.exe] Error 1
44 
45Execution terminated

What could be the problem? I don't have any variables or functions by these names:
Z5Tastev, Z8Desenarev etc.. i do have however Taste Desenare
Please help

GullRaDriel

These are not real errors, these are WARNING. You are passing a float where the function wait an int.

cars.cpp:17: warning: passing `float' for converting 3 of `void rotate_sprite(BITMAP*, BITMAP*, int, int, fixed)'
cars.cpp:17: warning: passing `float' for converting 4 of `void rotate_sprite(BITMAP*, BITMAP*, int, int, fixed)'
cars.cpp:17: warning: passing `float' for converting 3 of `void rotate_sprite(BITMAP*, BITMAP*, int, int, fixed)'
cars.cpp:17: warning: passing `float' for converting 4 of `void rotate_sprite(BITMAP*, BITMAP*, int, int, fixed)'

The others are not allegro related, but these are real errors.

1game.o(.text+0x0): In function `ZN3car4LoadEPc':
2M:/Cars/cars.cpp:7: multiple definition of `car::Load(char*)'
3main.o(.text+0x0):M:/Cars/cars.cpp:7: first defined here
4game.o(.text+0xa2): In function `ZN3car8DesenbufEv':
5M:/Cars/cars.cpp:16: multiple definition of `car::Desenbuf()'
6main.o(.text+0x6):M:/Cars/cars.cpp:16: first defined here
7game.o(.text+0x1a8): In function `Z5Tastev':
8M:/Cars/game.cpp:6: multiple definition of `Taste()'
9main.o(.text+0x10c):M:/Cars/game.cpp:6: first defined here
10game.o(.text+0x278): In function `Z8Desenarev':
11M:/Cars/game.cpp:14: multiple definition of `Desenare()'
12main.o(.text+0x1dc):M:/Cars/game.cpp:14: first defined here
13game.o(.text+0x308): In function `Z6Sunetev':
14M:/Cars/game.cpp:18: multiple definition of `Sunete()'
15main.o(.text+0x26c):M:/Cars/game.cpp:17: first defined here
16cars.o(.text+0x0): In function `ZN3car4LoadEPc':
17M:/Cars/cars.cpp:7: multiple definition of `car::Load(char*)'
18main.o(.text+0x0):M:/Cars/cars.cpp:7: first defined here
19cars.o(.text+0xa2): In function `ZN3car8DesenbufEv':
20M:/Cars/cars.cpp:16: multiple definition of `car::Desenbuf()'
21main.o(.text+0x6):M:/Cars/cars.cpp:16: first defined here
22collect2: ld returned 1 exit status
23 
24make.exe: *** [Cars.exe] Error 1
25 
26Execution terminated

You are using a third party library which you are not linking against. Looks like you need to link this "taste desenar" library, who is using the functions you do not know.

CGamesPlay
Quote:

Looks like you need to link this "taste desenar" library, who is using the functions you do not know.

Gull, "multiple definitions" isn't the same as "undefined reference"... If fact, it's the opposite :)

Quote:

i`m building a game using allegro library but i get the following error message .. do u know what might be the problem ?

It has nothing to do with Allegro. You are #including cpp files. Stop it.

You know how to create a header file? Do that, then #include the header file.

Adix88
Quote:

It has nothing to do with Allegro. You are #including cpp files. Stop it.

You know how to create a header file? Do that, then #include the header file.

Thx .. this was the problem .. my game works now :D

GullRaDriel

Arf :p My eyes were aimed by the bolded text who said "first defined here" :p

I did copy paste the code but without noticing the multiple definition ;-)

Anyway his problem is now solved.

But ... Hey ! Wait ! Adix88 , You are a cookie scrooge, aren't you ? ! ;)
_

Thread #590733. Printed from Allegro.cc