 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Panajev2001a
Joined: 20 Aug 2005 Posts: 100
|
Posted: Tue Mar 21, 2006 8:16 am Post subject: undefined reference to `_init()' |
|
|
Hi guys, I am still stuck in updating my application from FW 1.50 compatible to FW 2.00 + eLoader compatible and one of the things I am trying is the trick MrBrown suggested in a thread here regarding libSDL (I am not using SDL, but the problem might be similar so I am trying to add this fix too):
| Code: |
int SetupCallbacks();
/* Snippet of code, till main () added on March 20, 2006
If this flag is set to 1, the _init() function was called and all
global/static constructors have been called. */
static int init_was_called = 0;
__attribute__ ((constructor))
void loaderInit()
{
int kmode_is_available = (sceKernelDevkitVersion() < 0x02000010);
if (kmode_is_available) {
/* Do nefarious kernel stuff here */
}
init_was_called = 1;
}
extern void _init(void);
int main(int argc, char *argv[])
{
/* Fanjita's EBOOT loader can be configured to skip the call to _init().
Since we need _init() for C++, we check to see if _init() has been
called. If it hasn't we call it manually, after determining whether or
not we can access the kernel. */
if (!init_was_called) {
_init();
}
SetupCallbacks();
|
Naturally this resulted in:
| Code: | Panajev@Panajev /usr/local/pspdev/psp/sdk/samples/IGGS_PSP
$ make
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/main.o src/main.cpp
ccache psp-gcc -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -c -o
src/disablefpu.o src/disablefpu.S
bin2o -i ../gu/cube/logo.raw logo.o logo
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/point.o src/point.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/pmatrix.o src/pmatrix.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/PSP_Utils.o src/PSP_Utils.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/camera3d.o src/camera3d.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/Matrix_stack.o src/Matrix_stack.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/3dsloader.o src/3dsloader.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/ctextureP2.o src/ctextureP2.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -msingle-floa
t -funroll-loops -ffast-math -fsingle-precision-constant -fno-exceptions -fno-ex
ceptions -fno-rtti -c -o src/clipper3d.o src/clipper3d.cpp
ccache psp-gcc -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -c -o src/valloc.o src/valloc.c
ccache psp-gcc -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Os -m
single-float -funroll-loops -ffast-math -fsingle-precision-constant -fno-excepti
ons -L. -LC:/cygwin/usr/local/pspdev/psp/sdk/lib src/main.o src/disablefpu.o
logo.o src/point.o src/pmatrix.o src/PSP_Utils.o src/camera3d.o src/Matrix_stack
.o src/3dsloader.o src/ctextureP2.o src/clipper3d.o src/valloc.o -lpng -lz -lint
mdloader -lgeommath -lpspgu -lstdc++ -lm -lc -lpspdebug -lpspdisplay -lpspge -l
pspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lp
sputility -lpspuser -lpspkernel -o krondor.elf
src/main.o: In function `main':
main.cpp:(.text+0x124): undefined reference to `_init()'
collect2: ld returned 1 exit status
make: *** [krondor.elf] Error 1 |
I am using and have always used PSPSDK with the toolchain scripts kindly developed by oopo's so I am not trying any custom+fancy toolchain set-up, just to let you know.
Is there anything I am missing ? Do you need more data that I can provide to help me with this issue ?
Thanks anyways, I hope not to keep my application stuck in FW 1.50 land forever ;). |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Tue Mar 21, 2006 9:55 pm Post subject: |
|
|
Try replace the definition of _init() with this:
| Code: | #ifdef __cplusplus
extern "C" {
#endif
extern void _init(void);
#ifdef __cplusplus
}
#endif
|
It's required if you are using c++ |
|
| Back to top |
|
 |
Panajev2001a
Joined: 20 Aug 2005 Posts: 100
|
Posted: Wed Mar 22, 2006 3:51 am Post subject: |
|
|
| danzel wrote: | Try replace the definition of _init() with this:
| Code: | #ifdef __cplusplus
extern "C" {
#endif
extern void _init(void);
#ifdef __cplusplus
}
#endif
|
It's required if you are using c++ |
Edit: It did work, the program now links again correctly. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|