Underfined reference to CreateAviPlayer
Rodrigo Damazio <[email protected]> Thu, 17 Feb 2005 17:48:53 -0200
| Newsgroups | gmane.comp.multimedia.avifile.general |
|---|---|
| Message-ID | <[email protected]> |
Hello. I have seen a recent message on this list about this
problem, but it was disregarded as being from a newbie, it seems. I
guess it was not.
I was having a link problem with avifile:
g++ -g testeavi.cpp -c -o testeavi.o `avifile-config --cflags`
`sdl-config --cflags`
g++ testeavi.o -o testeavi `avifile-config --libs` `sdl-config
--static-libs`
testeavi.o(.text+0x1c4): In function `main':
/usr/src/matic/testeavi/testeavi.cpp:66: undefined reference to
`avm::CreateAviPlayer(char const*, int, char const*, unsigned, char
const*, char const*)'
collect2: ld returned 1 exit status
make: *** [testeavi] Error 1
Looking at the symbols in the library and my own testeavi.o, I
could see the C++ name mangling for the CreateAviPlayer method is
different in each, which is the reason for this error:
In libaviplay.so --> _ZN3avm15CreateAviPlayerEPKciS1_mS1_S1_
In my testeavi.o --> _ZN3avm15CreateAviPlayerEPKciS1_jS1_S1_
This would normally indicate that the two functions (header and
implementation) have different parameters, and indeed, in file
lib/aviplay/aviplay.cpp the parameter flags is an unsigned long, whereas
in the header file it is unsigned int. Changing the header file's
parameter to long solved the problem. I have not checked if there are
other functions with the same problem.
Rodrigo