[MPlayer-dev-eng] c++ and libmpcodec
Miroslav Shaltev
Miroslav.Shaltev at stud.uni-hannover.de
Mon Sep 12 21:16:28 CEST 2005
hi @ all,
i hope i post my quesion to the right place, if not so, please sorry (and ban
me to the right list -> tnx).
the problem:
i try to add a decoderlib to libmpcodecs. however the decoderlib is written in
c++ (?!) , so i can not simply include the headers and rest in a simple
vd_mylib.c file. therefor i add vd_mylib.cpp , change the Makefile. Running
make in libmpcodecs is ok, but make ontop ends with
g++ -I../libvo -I../../libvo -I/usr/X11R6/include -fno-PIC -O4 -march=athlon-4
-mcpu=athlon-4 -pipe -ffast-math -fomit-frame-pointer -I.
-I/usr/include/freetype2 -I/usr/include/SDL -I/usr/X11R6/include -o
mplayer mplayer.o mp_msg.o cpudetect.o codec-cfg.o spudec.o playtree.o
playtreeparser.o asxparser.o vobsub.o subreader.o sub_cc.o find_sub.o
m_config.o m_option.o parser-cfg.o m_struct.o edl.o unrarlib.o mixer.o
parser-mpcmd.o subopt-helper.o libvo/libvo.a libao2/libao2.a
vidix/libvidix.a libmpcodecs/libmpcodecs.a loader/libloader.a
loader/dshow/libDS_Filter.a loader/dmo/libDMO_Filter.a libaf/libaf.a
libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a
osdep/libosdep.a -Llibmpdvdkit2 -lmpdvdkit libavcodec/libavcodec.a -lmad
-lstdc++ -llzo -ldivxdecore -lxvidcore -lm -lpng -lz -lz -ljpeg -lasound
-ldl -lpthread -lfreetype -lz -lcdda_interface -lcdda_paranoia -lnsl
-lgif -lsmbclient -lfontconfig libfaad2/libfaad2.a mp3lib/libMP3.a
liba52/liba52.a libmpeg2/libmpeg2.a tremor/libvorbisidec.a -laa -lGL
-lXxf86dga -lXv -lXxf86vm -lXinerama -L/usr/X11R6/lib -lXext -lX11 -lnsl
-lnsl -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lvgagl -lvga -lm
-L/usr/kde/3.4/lib -ldl -lartsc -lpthread -lgmodule-2.0 -ldl -lgthread-2.0
-lglib-2.0 -L/usr/lib -lesd -laudiofile -lm -lasound -lbio2jack -ljack
-lpthread -ldl -rdynamic -lm
libmpcodecs/libmpcodecs.a(vd_mylib.o)(.text+0x23): In function `init':
: undefined reference to `showmsg'
collect2: ld returned 1 exit status
make: *** [mplayer] Error 1
showmsg is just a test funktion in my cpp file i try to "see" from
vd_mylib.c. i think the problem is in the way c++ handles function naming, or
so, there are in general visability problems between c / c++. in a simple two
file project, i can use c++ funktions in c program, the same syntax do not
works in mplayer, and i have really no idea why. for any suggestions many
many tnx.
regards,
miroslav
p.s. some code
in
vd_mylib.c
#include "vd_mylib_link.h"
static int init(sh_video_t *sh){
showmsg("I told you, you will see how stupied c++ can be!!!");
return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12);
}
in
vd_mylib_link.h
#ifdef __cplusplus
extern "C" {
#endif
int showmsg(const char *fStr);
#ifdef __cplusplus
}
#endif
in
vd_mylib.cpp
int showmsg(const char *fStr){
std::cout << fStr << std::endl;
return 0;
}
--
SHALTEV.ORG @ http://shaltev.no-ip.org
More information about the MPlayer-dev-eng
mailing list