Cannot compile with CodeBlocks

Decided to have a try at compiling and failed, I get this error in the Build Log:

[code] (…)
mingw32-g++.exe -Os -c C:\Users\Giuseppe\Downloads\Cataclysm-DDA-master\version.cpp -o obj\Release\version.o
mingw32-g++.exe -Os -c C:\Users\Giuseppe\Downloads\Cataclysm-DDA-master\weather.cpp -o obj\Release\weather.o
mingw32-g++.exe -Os -c C:\Users\Giuseppe\Downloads\Cataclysm-DDA-master\weather_data.cpp -o obj\Release\weather_data.o
mingw32-g++.exe -Os -c C:\Users\Giuseppe\Downloads\Cataclysm-DDA-master\wincurse.cpp -o obj\Release\wincurse.o
mingw32-g++.exe -Os -c C:\Users\Giuseppe\Downloads\Cataclysm-DDA-master\wish.cpp -o obj\Release\wish.o
mingw32-g++.exe -o Cataclysm.exe obj\Release\action.o obj\Release\addiction.o obj\Release\artifact.o obj\Release\basecamp.o obj\Release\bionics.o obj\Release\bodypart.o obj\Release\building_generation.o obj\Release\calendar.o obj\Release\catajson.o obj\Release\color.o obj\Release\computer.o obj\Release\construction.o obj\Release\crafting.o obj\Release\debug.o obj\Release\defense.o obj\Release\disease.o obj\Release\event.o obj\Release\faction.o obj\Release\field.o obj\Release\game.o obj\Release\gamemode.o obj\Release\graffiti.o obj\Release\help.o obj\Release\helper.o obj\Release\iexamine.o obj\Release\input.o obj\Release\inventory.o obj\Release\inventory_ui.o obj\Release\item.o obj\Release\item_factory.o obj\Release\item_group.o obj\Release\itypedef.o obj\Release\iuse.o obj\Release\keypress.o obj\Release\lightmap.o obj\Release\line.o obj\Release\main.o obj\Release\main_menu.o obj\Release\map.o obj\Release\mapbuffer.o obj\Release\mapdata.o obj\Release\mapgen.o obj\Release\mapgenformat.o obj\Release\mapitemsdef.o obj\Release\material.o obj\Release\melee.o obj\Release\mission.o obj\Release\mission_end.o obj\Release\mission_fail.o obj\Release\mission_place.o obj\Release\mission_start.o obj\Release\missiondef.o obj\Release\monattack.o obj\Release\mondeath.o obj\Release\mongroupdef.o obj\Release\monitemsdef.o obj\Release\monmove.o obj\Release\monster.o obj\Release\mtypedef.o obj\Release\mutation.o obj\Release\mutation_data.o obj\Release\name.o obj\Release\newcharacter.o obj\Release\npc.o obj\Release\npcmove.o obj\Release\npctalk.o obj\Release\options.o obj\Release\output.o obj\Release\overmap.o obj\Release\overmapbuffer.o obj\Release\player.o obj\Release\posix_time.o obj\Release\profession.o obj\Release\ranged.o obj\Release\rng.o obj\Release\settlement.o obj\Release\setvector.o obj\Release\skill.o obj\Release\text_snippets.o obj\Release\tileray.o obj\Release\trapdef.o obj\Release\trapfunc.o obj\Release\tutorial.o obj\Release\ui.o obj\Release\veh_interact.o obj\Release\veh_typedef.o obj\Release\vehicle.o obj\Release\version.o obj\Release\weather.o obj\Release\weather_data.o obj\Release\wincurse.o obj\Release\wish.o obj\Release\resource.res -Wl,-stack,12000000,-subsystem,windows -static -lgdi32 -mwindows
obj\Release\computer.o:computer.cpp:(.text+0x17077): undefined reference to libintl_vsprintf' obj\Release\computer.o:computer.cpp:(.text+0x171aa): undefined reference tolibintl_vsprintf’
obj\Release\computer.o:computer.cpp:(.text+0x17264): undefined reference to libintl_vsprintf' obj\Release\computer.o:computer.cpp:(.text+0x172ee): undefined reference tolibintl_vsprintf’
obj\Release\computer.o:computer.cpp:(.text+0x173ae): undefined reference to libintl_vsprintf' c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: obj\Release\computer.o: bad reloc address 0x7520 in section.rdata’
c:/mingw/bin/…/lib/gcc/mingw32/4.7.2/…/…/…/…/mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (3 minutes, 45 seconds)
5 errors, 0 warnings (3 minutes, 45 seconds)

[/code]

It’s my first try at compiling and I do not know what I am doing wrong or what I am missìng.

Do you think you could edit that to just use the [code][/code] tags? When you use both that and the spoiler it compresses it down to a scrollable box less then 1 line tall that is impossible to read.

Sorry. I thought that would save space, on the preview it worked fine.

The problem is you’re missing the gettext libraries. I’ll see about posting more specific instructions when I’m back at my regular computer.

I would really appreciate that, thank you.

Would really appreciate that too. Been having the same issue for at least three days now trying to compile latest builds.

Getting similar with mingw. Will wait for fix.

I managed to solve it by downloading this https://github.com/anope/windows-libs and getting the libintl.lib from there, then I linked it on CodeBlocks, I added the intl.dll and libintl.dll in the Cataclysm directory, but now I get this new error:

code
mingw32-g++.exe -Os -IC:\cygwin\lib -IC:\MinGW\lib -I"C:\Program Files (x86)\GnuWin32\lib" -IC:\MinGW\lib\gettext -c C:\Users\Giuseppe\Downloads\Cataclysm-DDA-master\weather_data.cpp -o obj\Release\weather_data.o
mingw32-g++.exe -Os -IC:\cygwin\lib -IC:\MinGW\lib -I"C:\Program Files (x86)\GnuWin32\lib" -IC:\MinGW\lib\gettext -c C:\Users\Giuseppe\Downloads\Cataclysm-DDA-master\wincurse.cpp -o obj\Release\wincurse.o
mingw32-g++.exe -Os -IC:\cygwin\lib -IC:\MinGW\lib -I"C:\Program Files (x86)\GnuWin32\lib" -IC:\MinGW\lib\gettext -c C:\Users\Giuseppe\Downloads\Cataclysm-DDA-master\wish.cpp -o obj\Release\wish.o
mingw32-g++.exe -o Cataclysm.exe obj\Release\action.o obj\Release\addiction.o obj\Release\artifact.o obj\Release\basecamp.o obj\Release\bionics.o obj\Release\bodypart.o obj\Release\building_generation.o obj\Release\calendar.o obj\Release\catajson.o obj\Release\color.o obj\Release\computer.o obj\Release\construction.o obj\Release\crafting.o obj\Release\debug.o obj\Release\defense.o obj\Release\disease.o obj\Release\event.o obj\Release\faction.o obj\Release\field.o obj\Release\game.o obj\Release\gamemode.o obj\Release\graffiti.o obj\Release\help.o obj\Release\helper.o obj\Release\iexamine.o obj\Release\input.o obj\Release\inventory.o obj\Release\inventory_ui.o obj\Release\item.o obj\Release\item_factory.o obj\Release\item_group.o obj\Release\itypedef.o obj\Release\iuse.o obj\Release\keypress.o obj\Release\lightmap.o obj\Release\line.o obj\Release\main.o obj\Release\main_menu.o obj\Release\map.o obj\Release\mapbuffer.o obj\Release\mapdata.o obj\Release\mapgen.o obj\Release\mapgenformat.o obj\Release\mapitemsdef.o obj\Release\material.o obj\Release\melee.o obj\Release\mission.o obj\Release\mission_end.o obj\Release\mission_fail.o obj\Release\mission_place.o obj\Release\mission_start.o obj\Release\missiondef.o obj\Release\monattack.o obj\Release\mondeath.o obj\Release\mongroupdef.o obj\Release\monitemsdef.o obj\Release\monmove.o obj\Release\monster.o obj\Release\mtypedef.o obj\Release\mutation.o obj\Release\mutation_data.o obj\Release\name.o obj\Release\newcharacter.o obj\Release\npc.o obj\Release\npcmove.o obj\Release\npctalk.o obj\Release\options.o obj\Release\output.o obj\Release\overmap.o obj\Release\overmapbuffer.o obj\Release\player.o obj\Release\posix_time.o obj\Release\profession.o obj\Release\ranged.o obj\Release\rng.o obj\Release\settlement.o obj\Release\setvector.o obj\Release\skill.o obj\Release\text_snippets.o obj\Release\tileray.o obj\Release\trapdef.o obj\Release\trapfunc.o obj\Release\tutorial.o obj\Release\ui.o obj\Release\veh_interact.o obj\Release\veh_typedef.o obj\Release\vehicle.o obj\Release\version.o obj\Release\weather.o obj\Release\weather_data.o obj\Release\wincurse.o obj\Release\wish.o obj\Release\resource.res -Wl,-stack,12000000,-subsystem,windows -static -lgdi32 …\Documents\Libs\gettext-0.18.1.1\lib\libintl.lib -mwindows
mingw32-g++.exe: error: obj\Release\mapitemsdef.o: No such file or directory
Process terminated with status 1 (3 minutes, 52 seconds)
1 errors, 0 warnings (3 minutes, 52 seconds)[/code]

What else am I missing now?


Do you have mapitemsdef.o in your Release directory?

Do you have mapitemsdef.o in your Release directory?

How exactly did you link it? Via mingw shell or somehow else?

It seems that I do not.

Right click on the left menu, build options, linker options, add, and I added it from there.

Ohh that’s right, I might have to remove mapitemsdef.cpp from the codeblocks project.

I wrote a short guide for those who had not figured out how to compile it now.

  1. Download Code::Blocks (codeblocks-12.11mingw-setup.exe) from here: http://www.codeblocks.org/downloads/26
    Direct link: http://sourceforge.net/projects/codeblocks/files/Binaries/12.11/Windows/codeblocks-12.11mingw-setup.exe

It is Code::Blocks and MinGW in one package. Install it after downloading.

  1. Since Code::Blocks cannot download projects from git you have to download it by yourselfs: https://github.com/CleverRaven/Cataclysm-DDA
    Direct link: https://github.com/CleverRaven/Cataclysm-DDA/archive/master.zip

  2. Then, you have to download lib from here: http://gnuwin32.sourceforge.net/packages/libintl.htm
    Direct link: http://gnuwin32.sourceforge.net/downlinks/libintl.php

Install it after downloading and copy libintl3.dll and libiconv2.dll to project folder.

  1. After installation, you have to link lib to the project as it told in this guide: http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/

  2. Unpack the project and open CataclysmWin.cbp in Code::Blocks.

  3. Project file is not always up-to-date and sometimes can miss some files or have some files that were deleted, go to Project>Remove files and remove all files then go to Project>Add files then select every .cpp and .h files you can sort them by using “C/C++ files” filter, also add “resouce.rc” after these steps go to Build>Build and wait until it will be completed.

Sorry if I have mistakes, English is not my native language and I don’t have much practice.

[s]Ok. I’ve just transited from command line Mingw to codeblocks, did everything like Musu wrote but on trying to build it returns a D:…\translations.h:4:21: fatal error: libintl.h: No such file or directory despite the fact that i’ve put libintl.h into cataclysm folder and included it into Cataclysm project. What gives?

And after deleting the reference to libintl.h from translations.h i got the following disease.cpp:837:17: error: ‘gettext’ was not declared in this scope[/s]
silly me. It finaly worked! And the only error now being mapitemsdef.o missing

FINALLY! IT WORKED!

Thank you Musu, You were of great help.

[quote=“NotSoAwesome, post:15, topic:2065”]FINALLY! IT WORKED!

Thank you Musu, You were of great help.[/quote]
I guess you removed mapitemsdef from the project? And then? Have you had any more errors like

obj\Release\bionics.o:bionics.cpp:(.text+0x1912f): undefined reference to `newwin(int, int, int, int)' obj\Release\bionics.o:bionics.cpp:(.text+0x1913d): undefined reference to `getbegx(WINDOW*)' obj\Release\bionics.o:bionics.cpp:(.text+0x19152): undefined reference to `getbegy(WINDOW*)'
?

I uninstalled all the mess of libraries I installed and I reinstalled Codeblocks, then I reinstalled the library in Musu’s post.

In codeblocks I went to Settings>Compiler Settings and there in the “Search directories” tab, under the Compiler tab I added the following directories:
C:\GnuWin32\include
C:\GnuWin32\share\gettext\intl
C:\MinGW\include (I downloaded MinGW and all the up to date libraries, just to be sure)

Under the “Linker” tab instead I added:
C:\MinGW\lib
C:\GnuWin32\lib

I pressed OK and opened the Cataclysm project (double click on CataclysmWin.cbp).
Then I right clicked on the left menu (the project menu) and selected “remove files…”, removed all files, then added them again, following step 6 of Musu’s guide;
right clicked on the project again, and selected “Build options…”, went to “linker settings” tab and added “…\GnuWin32\lib\libintl.lib”.
Then I clicked “build” and the thing worked.

NotSoAwesome you’re my hero now along with Musu. It now works like a charm!

Any easy MinGW Shell commands to link up the libs? I never could get codeblocks to work right for me.

You could edit the makefile. With makefile.windows, append “-IC:\libs\GetText\include” (use your own gettext directory, obviously) to CFLAGS. Then append “C:\libs\GetText\lib\libintl.dll.a” (again, using your own gettext directory) to LDFLAGS.