[winegcc] Cross compiling glut program

Hi.
I need to cross-compile my OpenGL/GLU/GLUT program to Windows platform, but there’s trouble with winegcc.


>winegcc *.c -lGL -lglut
artifact.c: In function ‘draw_artifacts’:
artifact.c:38:5: warning: incompatible implicit declaration of built-in function ‘printf’
artifact.c: In function ‘set_artifacts’:
artifact.c:61:3: warning: incompatible implicit declaration of built-in function ‘printf’
bmp.c: In function ‘load_bitmap’:
bmp.c:18:3: warning: incompatible implicit declaration of built-in function ‘printf’
bmp.c:26:5: warning: incompatible implicit declaration of built-in function ‘exit’
bmp.c:32:5: warning: incompatible implicit declaration of built-in function ‘exit’
bmp.c:38:5: warning: incompatible implicit declaration of built-in function ‘exit’
bmp.c:42:34: warning: incompatible implicit declaration of built-in function ‘malloc’
bmp.c:47:5: warning: incompatible implicit declaration of built-in function ‘exit’
bmp.c:54:5: warning: incompatible implicit declaration of built-in function ‘exit’
creature.c: In function ‘animate_creature’:
creature.c:30:5: warning: incompatible implicit declaration of built-in function ‘printf’
creature.c: In function ‘creature_add_new’:
creature.c:84:5: warning: incompatible implicit declaration of built-in function ‘printf’
creature.c: In function ‘move_creature_forward’:
creature.c:120:5: warning: incompatible implicit declaration of built-in function ‘printf’
creature.c: In function ‘turn_to_player’:
creature.c:141:5: warning: incompatible implicit declaration of built-in function ‘printf’
creature.c: In function ‘see_player’:
creature.c:204:5: warning: incompatible implicit declaration of built-in function ‘printf’
creature.c: In function ‘process_creature’:
creature.c:291:5: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c: In function ‘check_hero_collision_with_terrain’:
hero.c:40:3: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c: In function ‘run_hero’:
hero.c:108:5: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c: In function ‘hero_test_collision_with_artifact’:
hero.c:132:42: warning: initialization makes pointer from integer without a cast
hero.c:144:9: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c: In function ‘hero_test_collision_with_creature’:
hero.c:190:42: warning: initialization makes pointer from integer without a cast
hero.c:202:9: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c: In function ‘hero_run_from_creatures’:
hero.c:707:35: warning: initialization makes pointer from integer without a cast
hero.c: In function ‘hero_test_collision_with_creatures’:
hero.c:725:35: warning: initialization makes pointer from integer without a cast
hero.c: In function ‘move_hero_forward__’:
hero.c:766:3: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c: In function ‘move_hero_backward__’:
hero.c:816:3: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c: In function ‘rotate_hero_right’:
hero.c:883:3: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c: In function ‘process_hero’:
hero.c:943:5: warning: incompatible implicit declaration of built-in function ‘printf’
hero.c:1020:5: warning: incompatible implicit declaration of built-in function ‘printf’
main.c: In function ‘load_next_map’:
main.c:26:5: warning: incompatible implicit declaration of built-in function ‘snprintf’
main.c:27:5: warning: incompatible implicit declaration of built-in function ‘printf’
main.c: In function ‘display’:
main.c:37:23: warning: initialization makes pointer from integer without a cast
main.c:56:19: warning: incompatible implicit declaration of built-in function ‘cos’
main.c:56:66: warning: incompatible implicit declaration of built-in function ‘sin’
main.c: In function ‘app_init’:
main.c:82:10: warning: assignment makes pointer from integer without a cast
main.c:93:3: warning: incompatible implicit declaration of built-in function ‘printf’
main.c: In function ‘main’:
main.c:123:3: warning: passing argument 1 of ‘glutKeyboardFunc’ from incompatible pointer type
/usr/include/GL/freeglut_std.h:467:26: note: expected ‘void (*)(unsigned char,  int,  int)’ but argument is of type ‘void (*)(char,  int,  int)’
map.c: In function ‘map_load’:
map.c:36:7: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:41:5: warning: incompatible implicit declaration of built-in function ‘printf’
map.c:42:5: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:46:5: warning: incompatible implicit declaration of built-in function ‘printf’
map.c:47:5: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:50:9: warning: incompatible implicit declaration of built-in function ‘malloc’
map.c:56:7: warning: incompatible implicit declaration of built-in function ‘printf’
map.c:57:7: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:62:7: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:70:5: warning: incompatible implicit declaration of built-in function ‘printf’
map.c:71:5: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:76:5: warning: incompatible implicit declaration of built-in function ‘printf’
map.c:77:5: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:80:3: warning: incompatible implicit declaration of built-in function ‘printf’
map.c:83:23: warning: initialization makes pointer from integer without a cast
map.c:94:5: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:105:7: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:110:7: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:123:5: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:134:9: warning: incompatible implicit declaration of built-in function ‘exit’
map.c:140:9: warning: incompatible implicit declaration of built-in function ‘exit’
map.c: In function ‘map_detect_collision’:
map.c:346:3: warning: incompatible implicit declaration of built-in function ‘printf’
map.c:347:16: warning: incompatible implicit declaration of built-in function ‘floor’
map.c: In function ‘map_get_terrain_height’:
map.c:381:3: warning: incompatible implicit declaration of built-in function ‘printf’
map.c:382:12: warning: incompatible implicit declaration of built-in function ‘floor’
map.c: In function ‘map_check_outside_map’:
map.c:408:17: warning: incompatible implicit declaration of built-in function ‘floor’
md2.c: In function ‘model_new_virtual’:
md2.c:12:47: warning: incompatible implicit declaration of built-in function ‘malloc’
md2.c: In function ‘load_model’:
md2.c:49:5: warning: incompatible implicit declaration of built-in function ‘printf’
md2.c:50:5: warning: incompatible implicit declaration of built-in function ‘exit’
md2.c:56:21: warning: incompatible implicit declaration of built-in function ‘malloc’
md2.c:59:5: warning: incompatible implicit declaration of built-in function ‘printf’
md2.c:60:5: warning: incompatible implicit declaration of built-in function ‘exit’
md2.c:84:7: warning: incompatible implicit declaration of built-in function ‘printf’
md2.c:127:3: warning: incompatible implicit declaration of built-in function ‘free’
normal.c: In function ‘CalculateNormal’:
normal.c:38:20: warning: incompatible implicit declaration of built-in function ‘sqrt’
artifact-MW52Xp.o: In function `glutInit_ATEXIT_HACK':
artifact.c:(.text+0x26): undefined reference to `__glutInitWithExit'
artifact-MW52Xp.o: In function `glutCreateWindow_ATEXIT_HACK':
artifact.c:(.text+0x47): undefined reference to `__glutCreateWindowWithExit'
artifact-MW52Xp.o: In function `glutCreateMenu_ATEXIT_HACK':
artifact.c:(.text+0x68): undefined reference to `__glutCreateMenuWithExit'
creature-SJKjpn.o: In function `glutInit_ATEXIT_HACK':
creature.c:(.text+0x26): undefined reference to `__glutInitWithExit'
creature-SJKjpn.o: In function `glutCreateWindow_ATEXIT_HACK':
creature.c:(.text+0x47): undefined reference to `__glutCreateWindowWithExit'
creature-SJKjpn.o: In function `glutCreateMenu_ATEXIT_HACK':
creature.c:(.text+0x68): undefined reference to `__glutCreateMenuWithExit'
hero-Elkri8.o: In function `glutInit_ATEXIT_HACK':
hero.c:(.text+0x26): undefined reference to `__glutInitWithExit'
hero-Elkri8.o: In function `glutCreateWindow_ATEXIT_HACK':
hero.c:(.text+0x47): undefined reference to `__glutCreateWindowWithExit'
hero-Elkri8.o: In function `glutCreateMenu_ATEXIT_HACK':
hero.c:(.text+0x68): undefined reference to `__glutCreateMenuWithExit'
keyboard-H3cZNa.o: In function `glutInit_ATEXIT_HACK':
keyboard.c:(.text+0x26): undefined reference to `__glutInitWithExit'
keyboard-H3cZNa.o: In function `glutCreateWindow_ATEXIT_HACK':
keyboard.c:(.text+0x47): undefined reference to `__glutCreateWindowWithExit'
keyboard-H3cZNa.o: In function `glutCreateMenu_ATEXIT_HACK':
keyboard.c:(.text+0x68): undefined reference to `__glutCreateMenuWithExit'
main-4dVokt.o: In function `glutInit_ATEXIT_HACK':
main.c:(.text+0x26): undefined reference to `__glutInitWithExit'
main-4dVokt.o: In function `glutCreateWindow_ATEXIT_HACK':
main.c:(.text+0x47): undefined reference to `__glutCreateWindowWithExit'
main-4dVokt.o: In function `glutCreateMenu_ATEXIT_HACK':
main.c:(.text+0x68): undefined reference to `__glutCreateMenuWithExit'
main-4dVokt.o: In function `display':
main.c:(.text+0x2ea): undefined reference to `gluLookAt'
main-4dVokt.o: In function `main':
main.c:(.text+0x5c1): undefined reference to `gluPerspective'
md2-2-qGXGQL.o: In function `glutInit_ATEXIT_HACK':
md2-2.c:(.text+0x26): undefined reference to `__glutInitWithExit'
md2-2-qGXGQL.o: In function `glutCreateWindow_ATEXIT_HACK':
md2-2.c:(.text+0x47): undefined reference to `__glutCreateWindowWithExit'
md2-2-qGXGQL.o: In function `glutCreateMenu_ATEXIT_HACK':
md2-2.c:(.text+0x68): undefined reference to `__glutCreateMenuWithExit'
collect2: ld returned 1 exit status
winegcc: gcc failed

Why wine can’t find glut library? There’s no default installed glut on Windows or what?

I will use winegcc. Where put glut lib, def and header file?

Am 25.07.2012 18:16, schrieb Lachu:
>
> I will use winegcc. Where put glut lib, def and header file?
>
>
I would think you need to download and install the windows versions in wine.

Just a thought:
I never used winegcc for cross compiling, but I used mingw32-gcc (and
mingw64-gcc) both available for openSUSE and there are also all
important development packages like mingw32-freeglut,
mingw32-freeglut-devel available for that.
So maybe also for you that could be an alternative.


PC: oS 12.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.4 | GeForce GT 420
ThinkPad E320: oS 12.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.8.4 | HD 3000
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

I have installed mingw and mingw-gcc, but there’s only Windows(exe) binaries. I try to run mingw-gcc binary with WINE. There’s output:


wine /usr/i686-w64-mingw32/sys-root/mingw/bin/gcc.exe -lGL -lGLU -lglut *.c
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135
err:module:import_dll Library libgmp-10.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpc-2.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library libmpfr-4.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:import_dll Library zlib1.dll (which is needed by L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\usr\\i686-w64-mingw32\\sys-root\\mingw\\libexec\\gcc\\i686-w64-mingw32\\4.7.0\\cc1.exe" failed, status c0000135

How use mingw32 on Linux?

Am 27.07.2012 17:06, schrieb Lachu:
>
> How use mingw32 on Linux?
>
>
Show me please first the output from


rpm -qa '*mingw*'

to see if you have the correct packages installed.


PC: oS 12.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.4 | GeForce GT 420
ThinkPad E320: oS 12.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.8.4 | HD 3000
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

I have used this command:


> i686-w64-mingw32-gcc -lGL -lGLU -lglut *.c

And this is output:


artifact.c: In function 'draw_artifacts':
artifact.c:37:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
artifact.c: In function 'set_artifacts':
artifact.c:60:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
bmp.c: In function 'load_bitmap':
bmp.c:18:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
bmp.c:42:34: warning: incompatible implicit declaration of built-in function 'malloc' [enabled by default]
creature.c: In function 'animate_creature':
creature.c:30:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
creature.c: In function 'creature_add_new':
creature.c:84:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
creature.c: In function 'move_creature_forward':
creature.c:120:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
creature.c: In function 'turn_to_player':
creature.c:141:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
creature.c: In function 'see_player':
creature.c:204:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
creature.c: In function 'process_creature':
creature.c:291:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c: In function 'check_hero_collision_with_terrain':
hero.c:38:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c: In function 'run_hero':
hero.c:106:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c: In function 'hero_test_collision_with_artifact':
hero.c:130:42: warning: initialization makes pointer from integer without a cast [enabled by default]
hero.c:142:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c: In function 'hero_test_collision_with_creature':
hero.c:188:42: warning: initialization makes pointer from integer without a cast [enabled by default]
hero.c:200:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c: In function 'hero_run_from_creatures':
hero.c:705:35: warning: initialization makes pointer from integer without a cast [enabled by default]
hero.c: In function 'hero_test_collision_with_creatures':
hero.c:723:35: warning: initialization makes pointer from integer without a cast [enabled by default]
hero.c: In function 'move_hero_forward__':
hero.c:764:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c: In function 'move_hero_backward__':
hero.c:814:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c: In function 'rotate_hero_right':
hero.c:881:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c: In function 'process_hero':
hero.c:941:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
hero.c:1018:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
keyboard.c:2:25: fatal error: GL\freeglut.h: No such file or directory
compilation terminated.
main.c:2:24: fatal error: GL\freglut.h: No such file or directory
compilation terminated.
map.c:2:25: fatal error: GL\freeglut.h: No such file or directory
compilation terminated.
md2-2.c:32:25: fatal error: GL\freeglut.h: No such file or directory
compilation terminated.
md2.c: In function 'load_model':
md2.c:49:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
md2.c:59:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
md2.c:84:7: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
normal.c: In function 'CalculateNormal':
normal.c:38:20: warning: incompatible implicit declaration of built-in function 'sqrt' [enabled by default]

This means it don’t include glut header.

Am 27.07.2012 19:46, schrieb Lachu:
>
> I have used this command:
> [snip]

Look at post #6, without that info I asked for I cannot help you.


PC: oS 12.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.4 | GeForce GT 420
ThinkPad E320: oS 12.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.8.4 | HD 3000
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

Please Lachu, do not make it more difficult then it is. You copy/paste in one sweep the prompt and the command and the output in one CODE tag field. No need to explain then that you did command X and that it gave Y as output. Everybody can see that then at a glance.

So when I do what Martin asked you on my system:

henk@boven:~> rpm -qa '*mingw*'
henk@boven:~>

No explanation needed.

Am 27.07.2012 20:16, schrieb hcvv:
> henk@boven:~> rpm -qa ‘mingw
> henk@boven:~>
>
> No explanation needed.

:slight_smile: since you obviously do not cross compile from linux to windows.
To give the example from my PC where I cross compile


martinh@sirius:~> rpm -qa '*mingw*'
mingw64-readline-devel-6.2-1.10.noarch
mingw32-libidn-1.22-1.20.noarch
mingw32-gcc-fortran-4.7.0-3.13.noarch
mingw32-gnutls-2.12.18-1.17.noarch
mingw64-glib2-2.32.4-1.1.noarch
mingw32-cross-gcc-fortran-4.7.0-8.7.x86_64
mingw64-pdcurses-devel-3.4-3.10.noarch
mingw32-filesystem-52-55.1.noarch
mingw32-libffi-3.0.10-2.25.noarch
mingw32-libidn-lang-1.22-1.20.noarch
mingw32-libcurl-7.24.0-1.14.noarch
mingw64-libgpg-error-lang-1.10-1.20.noarch
mingw32-libintl-0.18.1.1-13.23.noarch
mingw32-binutils-2.22.52-1.12.noarch
mingw32-freeglut-devel-2.6.0-3.15.noarch
mingw32-libstdc++-4.7.0-3.13.noarch
mingw32-libssh2-1.2.8-3.18.noarch
mingw64-readline-6.2-1.10.noarch
mingw64-cross-pkg-config-0.27-2.1.x86_64
mingw32-termcap-devel-1.3.1-3.17.noarch
mingw64-termcap-devel-1.3.1-3.10.noarch
mingw64-cross-gcc-c++-4.7.0-6.3.x86_64
mingw32-fontconfig-devel-2.10.0-1.1.noarch
mingw32-freetype-devel-2.4.10-1.2.noarch
mingw32-gcc-4.7.0-3.13.noarch
mingw64-libssp-4.7.0-5.11.noarch
mingw32-readline-devel-6.2-1.17.noarch
mingw32-pdcurses-progs-3.4-4.17.noarch
mingw64-pdcurses-3.4-3.10.noarch
mingw32-mozilla-nspr-4.9-2.14.noarch
mingw32-libcurl-devel-7.24.0-1.14.noarch
mingw32-gdb-lang-7.3.1-2.18.noarch
mingw32-libgpg-error-lang-1.10-1.21.noarch
mingw32-libmpfr-3.1.0-1.20.noarch
mingw64-cross-gcc-fortran-4.7.0-6.3.x86_64
mingw32-glib2-lang-2.32.4-1.1.noarch
mingw32-libgnutls-extra-2.12.18-1.17.noarch
mingw64-libgpg-error-1.10-1.20.noarch
mingw64-libgfortran-4.7.0-5.11.noarch
mingw64-pkg-config-0.27-1.2.noarch
mingw64-libintl-0.18.1.1-11.12.noarch
mingw64-runtime-20120404-2.1.noarch
mingw32-headers-20120404-1.1.noarch
mingw32-libsqlite-3.7.6.2-1.22.noarch
mingw32-libgnutls-2.12.18-1.17.noarch
mingw64-libcurl-devel-7.24.0-1.15.noarch
mingw64-zlib-1.2.7-1.6.noarch
mingw64-libgcrypt-1.4.6-4.11.noarch
mingw64-cross-gcc-4.7.0-6.3.x86_64
mingw32-termcap-1.3.1-3.17.noarch
mingw32-cross-gcc-4.7.0-8.7.x86_64
mingw32-freeglut-2.6.0-3.15.noarch
mingw32-liblzma-5.0.4-1.2.noarch
mingw32-libgfortran-4.7.0-3.13.noarch
mingw32-cpp-4.7.0-3.13.noarch
mingw32-glew-devel-1.5.1-2.17.noarch
mingw32-readline-6.2-1.17.noarch
mingw64-headers-20120404-1.1.noarch
mingw64-termcap-1.3.1-3.10.noarch
mingw64-libtool-2.4-1.10.noarch
mingw32-zlib-devel-1.2.7-1.7.noarch
mingw32-libxml2-2.8.0-1.4.noarch
mingw32-libtiff-4.0.2-1.3.noarch
mingw32-libgs-8.71-4.23.noarch
mingw32-gnutls-lang-2.12.18-1.17.noarch
mingw64-cross-binutils-2.22.52-2.1.x86_64
mingw64-libsqlite-3.7.6.2-1.18.noarch
mingw64-libidn-lang-1.22-1.17.noarch
mingw64-curl-7.24.0-1.15.noarch
mingw32-glew-1.5.1-2.17.noarch
mingw32-pdcurses-devel-3.4-4.17.noarch
mingw32-cross-cpp-4.7.0-8.7.x86_64
mingw64-cross-cpp-4.7.0-6.3.x86_64
mingw32-libgpg-error-1.10-1.21.noarch
mingw64-pdcurses-progs-3.4-3.10.noarch
mingw32-glib2-2.32.4-1.1.noarch
mingw32-cross-pkg-config-0.26-3.1.x86_64
mingw32-fontconfig-2.10.0-1.1.noarch
mingw32-ghostscript-8.71-4.23.noarch
mingw64-libstdc++-4.7.0-5.11.noarch
mingw64-filesystem-43-44.1.noarch
mingw32-libtasn1-2.12-1.13.noarch
mingw32-libgcc-4.7.0-3.13.noarch
mingw32-freetype-2.4.10-1.2.noarch
mingw64-libgcc-4.7.0-5.11.noarch
mingw64-libssh2-1.2.8-3.19.noarch
mingw32-libgmp-5.0.5-1.4.noarch
mingw32-libtool-2.4-2.17.noarch
mingw32-fftw3-3.3-1.18.noarch
mingw32-fftw3-devel-3.3-1.18.noarch
mingw32-pkg-config-0.27-1.2.noarch
mingw64-mozilla-nspr-4.9-2.11.noarch
mingw32-libexpat-2.0.1-4.23.noarch
mingw32-runtime-20120404-1.9.noarch
mingw32-zlib-1.2.7-1.7.noarch
mingw32-mozilla-nss-3.13.3-1.15.noarch
mingw32-libgcrypt-1.4.6-4.12.noarch
mingw64-libidn-1.22-1.17.noarch
mingw64-libcurl-7.24.0-1.15.noarch
mingw32-pdcurses-3.4-4.17.noarch
mingw32-libssp-4.7.0-3.13.noarch
mingw32-libmpc-0.9-12.1.noarch
mingw32-gdb-7.3.1-2.18.noarch
mingw32-cross-binutils-2.22.52-2.1.x86_64
mingw64-libffi-3.0.10-6.20.noarch
mingw64-glib2-lang-2.32.4-1.1.noarch
mingw32-libjpeg-8d-3.5.noarch
mingw32-gcc-c++-4.7.0-3.13.noarch
mingw32-curl-7.24.0-1.14.noarch
mingw64-mozilla-nss-3.13.3-1.12.noarch
mingw32-cross-gcc-c++-4.7.0-8.7.x86_64
martinh@sirius:~>

the corresponding special repositories needed are
download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_12.1
download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_12.1
the glut libraries and headers are in
mingw32-freeglut-devel-2.6.0-3.15.noarch
mingw32-freeglut-2.6.0-3.15.noarch


PC: oS 12.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.4 | GeForce GT 420
ThinkPad E320: oS 12.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.8.4 | HD 3000
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10


> rpm -qa '*mingw*'
mingw32-cross-cpp-4.7.0-8.7.x86_64
mingw32-cpp-4.7.0-3.14.noarch
mingw32-zlib-1.2.7-1.7.noarch
mingw32-binutils-2.22.52-1.12.noarch
mingw32-libgcc-4.7.0-3.14.noarch
mingw32-libmpc-0.9-13.1.noarch
mingw32-headers-20120404-1.1.noarch
mingw32-cross-binutils-2.22.52-2.1.x86_64
mingw32-libgmp-5.0.5-1.4.noarch
mingw32-gcc-4.7.0-3.14.noarch
mingw32-freeglut-2.6.0-3.15.noarch
mingw32-libmpfr-3.1.0-1.20.noarch
mingw32-freeglut-devel-2.6.0-3.15.noarch
mingw32-runtime-20120404-1.9.noarch
mingw32-gc-7.2alpha6-1.19.noarch
mingw32-cross-gcc-4.7.0-8.7.x86_64
mingw32-filesystem-52-55.1.noarch


> i686-w64-mingw32-gcc -m32 -lopengl32 -lglu32 -lglut32 *.c
...
...
...
/tmp/ccf1kGx7.o:artifact.c:(.text+0x1c): undefined reference to `_imp____glutInitWithExit@12'
...
...
...
/tmp/ccuqAqJw.o:primitives.c:(.text+0x861): undefined reference to `_imp__glTexCoord2f@8'
/tmp/ccuqAqJw.o:primitives.c:(.text+0x89f): undefined reference to `_imp__glVertex3f@12'
/tmp/ccuqAqJw.o:primitives.c:(.text+0x8ba): undefined reference to `_imp__glTexCoord2f@8'
/tmp/ccuqAqJw.o:primitives.c:(.text+0x8f6): undefined reference to `_imp__glVertex3f@12'
/tmp/ccuqAqJw.o:primitives.c:(.text+0x900): undefined reference to `_imp__glEnd@0'
collect2: error: ld returned 1 exit status

Am 28.07.2012 18:16, schrieb Lachu:
>> i686-w64-mingw32-gcc -m32 -lopengl32 -lglu32 -lglut32 *.c
>


martinh@sirius:~> rpm -ql 'mingw32-freeglut'
/usr/i686-w64-mingw32/sys-root/mingw/bin/libglut-0.dll

why do you use “-lglut32”? Where is no glut32 dll there.
You cannot just copy arbitrary link switches from somewhere used by
somebody with a completely different set of libraries to link against
and expect it to work.
Have a look at what it is exactly what you have installed and check the
correct link and compile switches for that.

Btw compiling with a “*.c” does not take into account any dependicies
between the files and asks for a lot of trouble.
Do you have no makefile?


PC: oS 12.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.4 | GeForce GT 420
ThinkPad E320: oS 12.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.8.4 | HD 3000
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

Am 28.07.2012 18:26, schrieb Martin Helm:
> Am 28.07.2012 18:16, schrieb Lachu:
>>> i686-w64-mingw32-gcc -m32 -lopengl32 -lglu32 -lglut32 *.c
>>
>


> martinh@sirius:~> rpm -ql 'mingw32-freeglut'
> /usr/i686-w64-mingw32/sys-root/mingw/bin/libglut-0.dll
> 

why do you use “-lglut32”? Where is no glut32 dll there.
You cannot just copy arbitrary link switches from somewhere used by
somebody with a completely different set of libraries to link against
and expect it to work.
Have a look at what it is exactly what you have installed and check the
correct link and compile switches for that.

Btw compiling with a “*.c” does not take into account any dependicies
between the files and asks for a lot of trouble.
Do you have no makefile?

To give you a helping hand


-llibglut -lopengl32 -lglu32

of course also a glut32 library exists for you, it is part of the
mingw32-runtime package.
But using freeglut for the headers use also the compile switch to link
against the correct library, everything else asks for trouble.

I compile a small test program to check if that is correct, you find it
here SUSE Paste


i686-w64-mingw32-gcc glut_test.c -llibglut -lopengl32 -o glut_test.exe

and it works with wine


wine glut_test.exe

Screenshot: SUSE Paste


PC: oS 12.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.4 | GeForce GT 420
ThinkPad E320: oS 12.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.8.4 | HD 3000
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10


>i686-w64-mingw32-gcc  -lopengl32 -lglu32 -llibglut main.c
main.c: In function 'load_next_map':
main.c:31:5: warning: incompatible implicit declaration of built-in function 'snprintf' [enabled by default]
main.c:32:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
main.c: In function 'display':
main.c:42:23: warning: initialization makes pointer from integer without a cast [enabled by default]
main.c:61:19: warning: incompatible implicit declaration of built-in function 'cos' [enabled by default]
main.c:61:66: warning: incompatible implicit declaration of built-in function 'sin' [enabled by default]
main.c: In function 'app_init':
main.c:87:10: warning: assignment makes pointer from integer without a cast [enabled by default]
main.c:98:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
main.c: In function 'main':
main.c:128:3: warning: passing argument 1 of 'glutKeyboardFunc' from incompatible pointer type [enabled by default]
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/GL/glut.h:17:0,
                 from main.c:2:
/usr/i686-w64-mingw32/sys-root/mingw/include/GL/freeglut_std.h:467:26: note: expected 'void (*)(unsigned char,  int,  int)' but argument is of type 'void (*)(char,  int,  int)'
/tmp/cc9QIKGe.o:main.c:(.text+0x1c): undefined reference to `_imp____glutInitWithExit@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x3e): undefined reference to `_imp____glutCreateWindowWithExit@8'
/tmp/cc9QIKGe.o:main.c:(.text+0x60): undefined reference to `_imp____glutCreateMenuWithExit@8'
/tmp/cc9QIKGe.o:main.c:(.text+0x7f): undefined reference to `delete_current_map'
/tmp/cc9QIKGe.o:main.c:(.text+0xc1): undefined reference to `map_load'
/tmp/cc9QIKGe.o:main.c:(.text+0xf1): undefined reference to `get_hero'
/tmp/cc9QIKGe.o:main.c:(.text+0x100): undefined reference to `_imp__glutGet@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x152): undefined reference to `_imp__glClearColor@16'
/tmp/cc9QIKGe.o:main.c:(.text+0x163): undefined reference to `_imp__glClear@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x16d): undefined reference to `_imp__glLoadIdentity@0'
/tmp/cc9QIKGe.o:main.c:(.text+0x18e): undefined reference to `_imp__glColor3f@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x1b2): undefined reference to `_imp__glScalef@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x1d6): undefined reference to `_imp__glTranslatef@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x28c): undefined reference to `gluLookAt@72'
/tmp/cc9QIKGe.o:main.c:(.text+0x29c): undefined reference to `process_keyboard'
/tmp/cc9QIKGe.o:main.c:(.text+0x2a9): undefined reference to `process_hero'
/tmp/cc9QIKGe.o:main.c:(.text+0x2ae): undefined reference to `process_artifacts'
/tmp/cc9QIKGe.o:main.c:(.text+0x2b3): undefined reference to `earse_keyboard_state'
/tmp/cc9QIKGe.o:main.c:(.text+0x2b8): undefined reference to `draw_map'
/tmp/cc9QIKGe.o:main.c:(.text+0x2bd): undefined reference to `draw_creatures'
/tmp/cc9QIKGe.o:main.c:(.text+0x2c2): undefined reference to `draw_artifacts'
/tmp/cc9QIKGe.o:main.c:(.text+0x2cf): undefined reference to `process_creatures'
/tmp/cc9QIKGe.o:main.c:(.text+0x2d4): undefined reference to `_imp__glFlush@0'
/tmp/cc9QIKGe.o:main.c:(.text+0x2db): undefined reference to `_imp__glutSwapBuffers@0'
/tmp/cc9QIKGe.o:main.c:(.text+0x2e2): undefined reference to `check_player_win'
/tmp/cc9QIKGe.o:main.c:(.text+0x30e): undefined reference to `load_bitmap'
/tmp/cc9QIKGe.o:main.c:(.text+0x31f): undefined reference to `_imp__glEnable@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x337): undefined reference to `_imp__glGenTextures@8'
/tmp/cc9QIKGe.o:main.c:(.text+0x34f): undefined reference to `_imp__glBindTexture@8'
/tmp/cc9QIKGe.o:main.c:(.text+0x35f): undefined reference to `set_terrain_texture_id'
/tmp/cc9QIKGe.o:main.c:(.text+0x37b): undefined reference to `_imp__glTexParameteri@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x39c): undefined reference to `_imp__glTexParameteri@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x3bd): undefined reference to `_imp__glTexEnvi@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x428): undefined reference to `_imp__glTexImage2D@36'
/tmp/cc9QIKGe.o:main.c:(.text+0x432): undefined reference to `hero_init'
/tmp/cc9QIKGe.o:main.c:(.text+0x437): undefined reference to `creatures_init'
/tmp/cc9QIKGe.o:main.c:(.text+0x43c): undefined reference to `artifacts_init'
/tmp/cc9QIKGe.o:main.c:(.text+0x475): undefined reference to `_imp__glutInitDisplayMode@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x48e): undefined reference to `_imp__glutInitWindowSize@8'
/tmp/cc9QIKGe.o:main.c:(.text+0x4a7): undefined reference to `_imp__glutFullScreen@0'
/tmp/cc9QIKGe.o:main.c:(.text+0x4b5): undefined reference to `_imp__glutDisplayFunc@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x4c6): undefined reference to `_imp__glutIdleFunc@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x4d2): undefined reference to `arrows'
/tmp/cc9QIKGe.o:main.c:(.text+0x4d7): undefined reference to `_imp__glutSpecialFunc@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x4e8): undefined reference to `_imp__glDepthFunc@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x4f7): undefined reference to `_imp__glClearDepth@8'
/tmp/cc9QIKGe.o:main.c:(.text+0x508): undefined reference to `_imp__glEnable@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x519): undefined reference to `_imp__glDepthMask@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x52a): undefined reference to `_imp__glEnable@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x53b): undefined reference to `_imp__glEnable@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x547): undefined reference to `keys'
/tmp/cc9QIKGe.o:main.c:(.text+0x54c): undefined reference to `_imp__glutKeyboardFunc@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x565): undefined reference to `_imp__glColorMaterial@8'
/tmp/cc9QIKGe.o:main.c:(.text+0x576): undefined reference to `_imp__glMatrixMode@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x580): undefined reference to `_imp__glLoadIdentity@0'
/tmp/cc9QIKGe.o:main.c:(.text+0x5aa): undefined reference to `gluPerspective@32'
/tmp/cc9QIKGe.o:main.c:(.text+0x5b9): undefined reference to `_imp__glMatrixMode@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x5cf): undefined reference to `_imp__glutGet@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x5f5): undefined reference to `_imp__glLightfv@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x616): undefined reference to `_imp__glLightfv@12'
/tmp/cc9QIKGe.o:main.c:(.text+0x627): undefined reference to `_imp__glEnable@4'
/tmp/cc9QIKGe.o:main.c:(.text+0x636): undefined reference to `_imp__glutMainLoop@0'
collect2: error: ld returned 1 exit status

Tomorrow I will try compile this program on computer with Windows, but the same compiler(Dev-C++ IDE). I must only remind where install libraries(lib and a files) on Windows.

> rpm -ql ‘mingw32-freeglut’
/usr/i686-w64-mingw32/sys-root/mingw/bin/libglut-0.dll


/tmp/cc9QIKGe.o:main.c:(.text+0x4b5): undefined reference to `_imp__glutDisplayFunc@4'

It seems compiler tries to find 32-bit code, when library is 64bit. @4 probably means 4-bit pointer, when it should search for version of this function with @8-bit pointer.

Running compiler with -m32 parameter will give the same result.

Several things:

-m32 has no meaning here you use the 32bit compiler (mingw32)

The symbol is where it should be

martinh@sirius:~> i686-w64-mingw32-objdump -x /usr/i686-w64-mingw32/sys-root/mingw/lib/libglut.dll.a | grep _imp__glutDisplayFunc@4
  7](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 __imp__glutDisplayFunc@4

The library is 32bit, all libraries with the mingw32 “branding” are 32bit, this is not your problem.
It looks like your system is screwed and the mingw cross compiler finds almost nothing it should find.

Run with the -v switch

i686-w64-mingw32-gcc -v -lopengl32 -lglu32 -llibglut main.c

and paste the result to susepaste.org and give the link.

I am not sure if I can see what is wrong with your system, but it looks as if not even the simplest things work for you.
Try to compile the test program I gave you the link previously, it is trivial, can you compile that?

OMG why did I not see that, I hope you know that the order in which you give parameters to the compiler matters?
Turn that please

i686-w64-mingw32-gcc -v -lopengl32 -lglu32 -llibglut main.c

into

i686-w64-mingw32-gcc -v main.c -lopengl32 -lglu32 -llibglut

SUSE Paste

Above is output for test program.
Again compiling test program with -v switch:
SUSE Paste

I don’t compile the program on Windows platform. Both Dev-C++ and Netbeans fail.

Am 29.07.2012 16:46, schrieb Lachu:
>
> ‘SUSE Paste’ (http://susepaste.org/52510761)
>
> Above is output for test program.
> Again compiling test program with -v switch:
> ‘SUSE Paste’ (http://susepaste.org/58778253)
>
> I don’t compile the program on Windows platform. Both Dev-C++ and
> Netbeans fail.
>
>
This was not the command I gave you!


i686-w64-mingw32-gcc -llibglut -lopengl32 -lglu32 ./test.c

what I gave you was


i686-w64-mingw32-gcc glut_test.c -llibglut -lopengl32 -o glut_test.exe

(translated to you using test.c for the source code and without -o)


i686-w64-mingw32-gcc test.c -llibglut -lopengl32 -lglu32

do you understand the difference???
I again advise you to understand that the order in which you give the
compiler switches MATTERS.
The link switches have to be AFTER the source file!!!


PC: oS 12.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.4 | GeForce GT 420
ThinkPad E320: oS 12.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.8.4 | HD 3000
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10