Simple Port - So I Know Where I'm Going Wrong


namco

Member
Joined
Mar 22, 2006
Messages
410
Age
42
Location
Manchester, UK
Website
www.stupendous-stuff.com
I've gone for something a little simpler to try and code and after statically linking I get linker errors. Here's the compile log:

Code:
Compiler: gp2x
Building Makefile: "C:\Documents and Settings\James\Desktop\njam-1.25-src\njam-1.25-src\src\Makefile.gp2x"
Executing  make clean
rm -f gp2x/SDL_main.o gp2x/njamedit.o gp2x/njamfont.o gp2x/njamgame.o gp2x/njammap.o gp2x/njamnet.o gp2x/njamutils.o gp2x/njam.o njam.gpe

cygwin-mkdir -p "gp2x"

g++.exe -c SDL_main.c -o gp2x/SDL_main.o -I"C:/gp2xsdk_windows/GP2XSDK/include/GP2X"  -I"C:/gp2xsdk_windows/GP2XSDK/include/SDL"  -I"C:/gp2xsdk_windows/GP2XSDK/lib/gcc/mingw32/3.4.2/include"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/backward"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/mingw32"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2"  -I"C:/gp2xsdk_windows/GP2XSDK/include"	-DGP2X

g++.exe -c njamedit.cpp -o gp2x/njamedit.o -I"C:/gp2xsdk_windows/GP2XSDK/include/GP2X"  -I"C:/gp2xsdk_windows/GP2XSDK/include/SDL"  -I"C:/gp2xsdk_windows/GP2XSDK/lib/gcc/mingw32/3.4.2/include"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/backward"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/mingw32"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2"  -I"C:/gp2xsdk_windows/GP2XSDK/include"	-DGP2X

g++.exe -c njamfont.cpp -o gp2x/njamfont.o -I"C:/gp2xsdk_windows/GP2XSDK/include/GP2X"  -I"C:/gp2xsdk_windows/GP2XSDK/include/SDL"  -I"C:/gp2xsdk_windows/GP2XSDK/lib/gcc/mingw32/3.4.2/include"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/backward"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/mingw32"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2"  -I"C:/gp2xsdk_windows/GP2XSDK/include"	-DGP2X

g++.exe -c njamgame.cpp -o gp2x/njamgame.o -I"C:/gp2xsdk_windows/GP2XSDK/include/GP2X"  -I"C:/gp2xsdk_windows/GP2XSDK/include/SDL"  -I"C:/gp2xsdk_windows/GP2XSDK/lib/gcc/mingw32/3.4.2/include"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/backward"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/mingw32"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2"  -I"C:/gp2xsdk_windows/GP2XSDK/include"	-DGP2X

g++.exe -c njammap.cpp -o gp2x/njammap.o -I"C:/gp2xsdk_windows/GP2XSDK/include/GP2X"  -I"C:/gp2xsdk_windows/GP2XSDK/include/SDL"  -I"C:/gp2xsdk_windows/GP2XSDK/lib/gcc/mingw32/3.4.2/include"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/backward"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/mingw32"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2"  -I"C:/gp2xsdk_windows/GP2XSDK/include"	-DGP2X

g++.exe -c njamnet.cpp -o gp2x/njamnet.o -I"C:/gp2xsdk_windows/GP2XSDK/include/GP2X"  -I"C:/gp2xsdk_windows/GP2XSDK/include/SDL"  -I"C:/gp2xsdk_windows/GP2XSDK/lib/gcc/mingw32/3.4.2/include"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/backward"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/mingw32"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2"  -I"C:/gp2xsdk_windows/GP2XSDK/include"	-DGP2X

g++.exe -c njamutils.cpp -o gp2x/njamutils.o -I"C:/gp2xsdk_windows/GP2XSDK/include/GP2X"  -I"C:/gp2xsdk_windows/GP2XSDK/include/SDL"  -I"C:/gp2xsdk_windows/GP2XSDK/lib/gcc/mingw32/3.4.2/include"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/backward"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/mingw32"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2"  -I"C:/gp2xsdk_windows/GP2XSDK/include"	-DGP2X

g++.exe -c njam.cpp -o gp2x/njam.o -I"C:/gp2xsdk_windows/GP2XSDK/include/GP2X"  -I"C:/gp2xsdk_windows/GP2XSDK/include/SDL"  -I"C:/gp2xsdk_windows/GP2XSDK/lib/gcc/mingw32/3.4.2/include"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/backward"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2/mingw32"  -I"C:/gp2xsdk_windows/GP2XSDK/include/c++/3.4.2"  -I"C:/gp2xsdk_windows/GP2XSDK/include"	-DGP2X

g++.exe gp2x/SDL_main.o gp2x/njamedit.o gp2x/njamfont.o gp2x/njamgame.o gp2x/njammap.o gp2x/njamnet.o gp2x/njamutils.o gp2x/njam.o -o njam.gpe -L"C:/gp2xsdk_windows/GP2XSDK/lib" -static -L"C:/gp2xsdk_windows/GP2XSDK/lib" -lSDL -lSDLmain -lSDL_image -lSDL_mixer -lSDL_net   

C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG.o): In function `IMG_LoadTyped_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG.c:104: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG.c:110: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG.c:144: undefined reference to `SDL_SetError'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_tga.o): In function `unsupported':
E:/Work/SDL/SDL_image-1.2.4/IMG_tga.c:88: undefined reference to `SDL_SetError'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_tga.o): In function `IMG_LoadTGA_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_tga.c:202: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_tga.c:314: undefined reference to `SDL_SetError'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_bmp.o): In function `LoadBMP_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:186: undefined reference to `SDL_ClearError'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:188: undefined reference to `SDL_Error'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:193: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:197: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:198: undefined reference to `SDL_ReadLE16'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:199: undefined reference to `SDL_ReadLE16'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:200: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:203: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:205: undefined reference to `SDL_ReadLE16'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:206: undefined reference to `SDL_ReadLE16'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:207: undefined reference to `SDL_ReadLE16'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:208: undefined reference to `SDL_ReadLE16'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:216: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:217: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:218: undefined reference to `SDL_ReadLE16'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:219: undefined reference to `SDL_ReadLE16'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:220: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:221: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:222: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:223: undefined reference to `SDL_ReadLE32'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:224: undefined reference to `SDL_ReadLE32'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_bmp.o):E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:225: more undefined references to `SDL_ReadLE32' follow
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_bmp.o): In function `LoadBMP_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:299: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:303: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:340: undefined reference to `SDL_Error'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:346: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:374: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_bmp.c:388: undefined reference to `SDL_Error'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_pnm.o): In function `IMG_LoadPNM_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_pnm.c:141: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_pnm.c:150: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_pnm.c:224: undefined reference to `SDL_SetError'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_xpm.o): In function `load_xpm':
E:/Work/SDL/SDL_image-1.2.4/IMG_xpm.c:352: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_xpm.c:358: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_xpm.c:448: undefined reference to `SDL_SetError'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_pcx.o): In function `IMG_LoadPCX_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_pcx.c:136: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_pcx.c:236: undefined reference to `SDL_SetError'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_gif.o): In function `IMG_LoadGIF_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_gif.c:166: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_gif.c:170: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_gif.c:177: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_gif.c:186: undefined reference to `SDL_SetError'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_gif.o):E:/Work/SDL/SDL_image-1.2.4/IMG_gif.c:199: more undefined references to `SDL_SetError' follow
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_gif.o): In function `ReadImage':
E:/Work/SDL/SDL_image-1.2.4/IMG_gif.c:532: undefined reference to `SDL_CreateRGBSurface'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_jpg.o): In function `jpeg_SDL_RW_src':
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:169: undefined reference to `_imp__jpeg_resync_to_restart'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_jpg.o): In function `IMG_LoadJPG_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:206: undefined reference to `_imp__jpeg_std_error'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:211: undefined reference to `_imp__jpeg_destroy_decompress'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:212: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:217: undefined reference to `_imp__jpeg_CreateDecompress'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:219: undefined reference to `_imp__jpeg_read_header'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:230: undefined reference to `_imp__jpeg_calc_output_dimensions'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:233: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:242: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:247: undefined reference to `_imp__jpeg_start_decompress'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:251: undefined reference to `_imp__jpeg_read_scanlines'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:253: undefined reference to `_imp__jpeg_finish_decompress'
E:/Work/SDL/SDL_image-1.2.4/IMG_jpg.c:257: undefined reference to `_imp__jpeg_destroy_decompress'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_lbm.o): In function `IMG_LoadLBM_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_lbm.c:245: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_lbm.c:469: undefined reference to `SDL_SetError'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_png.o): In function `IMG_isPNG':
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:86: undefined reference to `png_sig_cmp'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_png.o): In function `png_read_data':
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:94: undefined reference to `png_get_io_ptr'
C:/gp2xsdk_windows/GP2XSDK/lib\libSDL_image.a(IMG_png.o): In function `IMG_LoadPNG_RW':
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:123: undefined reference to `png_create_read_struct'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:126: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:131: undefined reference to `png_create_info_struct'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:133: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:142: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:147: undefined reference to `png_set_read_fn'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:150: undefined reference to `png_read_info'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:151: undefined reference to `png_get_IHDR'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:155: undefined reference to `png_set_strip_16'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:160: undefined reference to `png_set_packing'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:164: undefined reference to `png_set_expand'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:169: undefined reference to `png_get_valid'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:172: undefined reference to `png_get_tRNS'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:189: undefined reference to `png_set_expand'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:196: undefined reference to `png_set_gray_to_rgb'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:198: undefined reference to `png_read_update_info'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:200: undefined reference to `png_get_IHDR'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:219: undefined reference to `SDL_CreateRGBSurface'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:222: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:239: undefined reference to `SDL_SetError'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:250: undefined reference to `png_read_image'
E:/Work/SDL/SDL_image-1.2.4/IMG_png.c:281: undefined reference to `png_destroy_read_struct'
collect2: ld returned 1 exit status

make.exe: *** [njam.gpe] Error 1

Execution terminated

I don't know where this "E:/Work" thing has come from.

Any ideas?
 
I didn't really look at it properly, so I don't know if I am any help, but the linking order of the libs does matter.

BTW: Under Windows I recommend to use the devkitGP2X from the archive instead of the original SDK.
 
Order of lib matters : the linker takes lib from left to right, and only fetch symbols that are still undefined. If you use "-lfoo -lbar" and if bar use symbols of foo he don't know they are in foo, and complains.

So, order your libs properly (SDL at the end), or use the magic command line option that disable this behavior.
 
Back
Top