allegro4 with code::blocks mingw

I want to use the allegro4 based Eagle4 GUI with code::blocks on Windows10.

Eagle4 wants to have allegro installed to be build. Therefore I want to build allegro 4.4.2 with the mingw provided by my code::blocks installation.

I installed the required cmake and dx80_mingw and executed

cmake .. -G"CodeBlocks - Unix Makefiles" from the allegro/build folder.

1-- CMAKE_RC_COMPILER: C:/Program Files (x86)/CodeBlocks/MinGW/bin/windres.exe 2-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 3-- Using MINGDIR: C:/Program Files (x86)/CodeBlocks/MinGW 4-- CMAKE_INSTALL_PREFIX: C:/Program Files (x86)/CodeBlocks/MinGW 5-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 6-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR) 7-- Could NOT find VORBIS (missing: OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRAR 8Y VORBIS_LIBRARY VORBISFILE_LIBRARY) 9CMake Warning (dev) at cmake/Common.cmake:52 (add_executable): 10 Policy CMP0037 is not set: Target names should not be reserved and should 11 match a validity pattern. Run "cmake --help-policy CMP0037" for policy 12 details. Use the cmake_policy command to set the policy and suppress this 13 warning. 14 15 The target name "test" is reserved or not valid for certain CMake features, 16 such as generator expressions, and may result in undefined behavior. 17Call Stack (most recent call first): 18 tests/CMakeLists.txt:12 (add_our_executable) 19This warning is for project developers. Use -Wno-dev to suppress it. 20 21-- Configuring done 22-- Generating done 23-- Build files have been written to: C:/Users/Henrik Schmidt/Documents/Source/Ea 24gle4/allegro/build

Followed up by make I ran into this problem

[ 19%] Building C object CMakeFiles/allegro.dir/src/c/czscan8.c.obj
[ 20%] Building C object CMakeFiles/allegro.dir/src/misc/ccolconv.c.obj
[ 20%] Building C object CMakeFiles/allegro.dir/src/misc/colconv.c.obj
[ 20%] Building RC object CMakeFiles/allegro.dir/src/win/dllver.rc.obj
Der Befehl "C:/Program" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
C:/Program Files (x86)/CodeBlocks/MinGW/bin/windres.exe: preprocessing failed.
CMakeFiles/allegro.dir/build.make:2487: recipe for target 'CMakeFiles/allegro.dir/src/win/dllver.rc.obj' failed
make[2]: *** [CMakeFiles/allegro.dir/src/win/dllver.rc.obj] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/allegro.dir/all' failed
make[1]: *** [CMakeFiles/allegro.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

What do I have to fix to build allegro ?


From the message about "C:/Program", the space in the name "Program files" is certainly an issue.
You should install things in directories that have no space in their path.


It managed to compile 20% with the same space including path setup and only stopped first using windres.exe. There must be also another problem/solution.


Because the first 20% don't need windres.exe (It is the tool for managing "resource" files, typically to include icons in executables)

It's the first line of the page:


MinGW may have problems with paths containing spaces, and if not, usually other programs used with MinGW will experience problems with such paths. Thus, we strongly recommend that you do not install MinGW in any location with spaces in the path name reference. You should avoid installing into any directory or subdirectory having names like "Program Files" or "My Documents", etc.


I understand that. But why did it fail ? Obviously the build process is capable of compiling with gcc without having problems with spaces in path. There must be a better solution than to avoid having spaces in path.

Ouch. Just read your addition to your post about mingw and spaces. That sucks.

I reinstalled code::blocks to c:\codeblocks and tried again. 13% later

[ 33%] Building C object docs/CMakeFiles/makedoc.dir/src/makedoc/makesci.c.obj
[ 33%] Linking C executable makedoc.exe
[ 33%] Built target makedoc
Scanning dependencies of target docs
[ 33%] Generating txt/abi.txt
The command "." is either misspelled or could not be found.
docs/CMakeFiles/docs.dir/build.make:120: recipe for target 'docs/txt/abi.txt' failed
make[2]: *** [docs/txt/abi.txt] Error 1
CMakeFiles/Makefile2:307: recipe for target 'docs/CMakeFiles/docs.dir/all' failed
make[1]: *** [docs/CMakeFiles/docs.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Edgar Reynaldo
Larkin said:

cmake .. -G"CodeBlocks - Unix Makefiles" from the allegro/build folder.

Why are you using the "Unix Makefiles" generator? If you're using MinGW, use "MinGW Makefiles", and if you're using MSYS, use "MSYS Makefiles".

Also, you're never gonna get everything right using cmake by itself. Use 'cmake-gui ..' and configure everything with the gui.

Why is 4.4.2 a requirement? I have binaries of MinGW-W64 GCC 7.1, Allegro 4.4.3, and EagleClassic available already built.

Also, if you're using MinGW-W64, it comes with DirectX, you just have to tell cmake where to find it. It's in the i686-mingw...\include folder in the mingw distribution.


My final goal is to help a friend with his game, coding some GUI stuff for him. He is already using allegro 4.4.2 and MSVC 2010 and won't change that.

Therefore the idea was to use eagle4 as a dll library build with MSVC 2010 which is happily working together with the already existing allegro 4.4.2 also build with MSVC 2010.

So what is the easiest way to create eagle4.dll / eagle4.lib with these requirements ?

Edgar Reynaldo

Then you need to compile Eagle using the A4.4.2 binaries you have. Just change the linker settings for the dynamic eagle targets and the search directories for compiler and linker.


Can the code::blocks mingw compile eagle with allegro binaries which were build with MSVC ?

All my problems are based on eagle compiling perfectly with mingw but I need it for use with MSVC.

Obviously I'm lacking the understanding on how dlls can be matched and mixed across different compilers.

Perhaps the best approach is to use code:blocks, switch its compiler from g++ to visual c++ and make eagle compatible with this. It throws some errors but it might be fixable.

Thanks for your patience.

Edgar Reynaldo

I'm pretty sure gcc can link to a .dll directly. The problem is getting a .lib file for eagle and msvc.

Larkin said:

Perhaps the best approach is to use code:blocks, switch its compiler from g++ to visual c++ and make eagle compatible with this. It throws some errors but it might be fixable.

I think this is your best bet.


Ok. It does complie now with VC++.

Now I have the problem to determine which functions I need to tag with __declspec(dllexport) to build a proper dll library.

Edgar Reynaldo

I think you can get around that with the .def files that CB can generate.


Is a mingw created def file from codeblocks compatible afterwards with a VC++ dll build project ?

Edgar Reynaldo

.def should be a standard format, but I was speaking of manipulating CodeBlocks library builds to create an export and import file.

Also, you don't want to go marking functions as declspec(dll_export). Use a macro, because when you want to include those headers in your program, they will have to be declared declspec(dll_import).

Thread #617203. Printed from