[Solved/Devs must read] win32gcc projects,mkfiles are broken
Posted: Fri Aug 16, 2013 8:24 pm
All of the steps below used the projectfiles/makefiles distributed with Irrlicht, no changes were made to them.
Building Irrlicht as a static library:
Fixes: - the following list is still being populated ... -
In the makefile of each "example" project.
In Irrlicht-gcc.cbp
Building Irrlicht as a static library:
Using Irrlicht statically:First of all, building Irrlicht using the command make win32 as stated in the Makefile is failing while compiling LzmaDec.c .
The Code::Blocks project used to build Irrlicht errorneously states that Win32 -static targets are built in win32-release/debug-shared.
Overall, building Irrlicht as Win32 Debug -static with Code::Blocks (not make) works producing a 50MB .a file.
Building hello world #1 with the command make static_win32 adds linux directories. It also fails to link libIrrlicht.a since the compiler complains about an undefined reference _imp__createDevice.
Code::Blocks also reports the undefined reference.
Am I doing something wrong?
Fixes: - the following list is still being populated ... -
In the makefile of each "example" project.
- Change CPPFLAGS from
to
Code: Select all
CPPFLAGS = -I../../include -I/usr/X11R6/include
and add this line below #target specific settingsCode: Select all
CPPFLAGS = -I../../include
Code: Select all
all_linux: CPPFLAGS += -I/usr/X11R6/include
- Change all_win32: LDFLAGS from
to
Code: Select all
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
NOTE #1: You might need to add -ld3dx9d for Direct3D support (9.0) depending wether you compiled Irrlicht with -DNO_IRR_COMPILE_WITH_DIRECT3D_9_ or -DIRR_COMPILE_WITH_DX9_DEV_PACKCode: Select all
all_win32: LDFLAGS = -static-libgcc -static-libstdc++ -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm -lwinmm -lgdi32
NOTE #2: When trying to use Irrlicht as a shared library you shouldn't include opengl32 winmm gdi32 and d3dx9d since Irrlicht automagically links itself to those. - Add this line below all_win32: LDFLAGS if it doesn't already exist and read NOTE #1.
NOTE #1: Remove -D_USRDLL and -D_MBCS these are microsofts-compiler-related, I don't believe they're of any use to gcc.
Code: Select all
all_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_IRR_STATIC_LIB_
NOTE #2: If you are compiling without joystick support make sure Irrlicht is compiled with -DNO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_, you should also include that in the above flags. Also remove -lwinmm you won't need it unless you like joysticks.
In Irrlicht-gcc.cbp
- under each -static target change
to
Code: Select all
<Option object_output="..\obj\win32-gcc-...-shared"/>
Code: Select all
<Option object_output="..\obj\win32-gcc-...-static"/>