Afficher un message
Vieux 10/04/2008, 22h19   #1
Messages: n/a
Par défaut Compiling OSLib in C++


first off, this library really kicks ass! great that its existing.

but what i would want to do:

compile a program with C++ instead of pure C.

i have seen a thread saying that actually it should be possible to compile C++.

unfortunately as soon as i try to compile in C++, the procedure fails with errors.


i take the first example (Hello World) from the wiki page:

i copy paste the c code into a main.cpp file, i copy paste the code for the makefile into my makefile.
i copy a icon0.png file into the directory.
i compile --> success.

now i try to compile C++:
i take the main.c file and rename it to main.cpp.
i open the file, and change

#include <oslib/oslib.h>

extern "C"
#include <oslib/oslib.h>
i do not change the makefile, there is already
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
in there by default.

i now run "make clean", and run make.

i now get the following error:

g:/pspdev/psp/sdk/lib/libosl.a(oslib.o): In function `oslSetupFTrigo':
/home/Florian/oslib/oslib.c:106: multiple definition of `osl_powerCallback'
main.o.sbss+0x4): first defined here
collect2: ld returned 1 exit status
make: *** [test.elf] Error 1

the thread i found mentioned that the guy played with the CFLAGS, so i tried

-G0 -Wall -O2
instead of
-G4 -Wall -O2
still no success.

can anyone help me? i would greatly appreciate it!!!!
if you can help me get it to run then i would also like to write a short tutorial for people after me trying the same thing, so the guys after me have an easier time

if you need to know the version of oslib i use, please tell me where i can find it, i do not find a version reference anywhere.

btw: yes, i also tried NOT to add the extern "C" to the sample. it still does not work.

thanks in advance!

mes remerciments

  Réponse avec citation