Author Topic: Newby Guide to Compiling (and Editing) With Code::Blocks  (Read 9019 times)

Offline Frostwood

  • NPC
  • **
  • Posts: 107
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #15 on: November 23, 2015, 05:10:17 AM »
After tearing my hair out trying to get this working, I will post this guide so you don't have to too.

The guide is obsolete: the compiler included with code::blocks doesn't work with the current builds.

To fix this:

Follow the installation instructions above.

Download http://sourceforge.net/projects/mingw-w64/ it's the updated complier.

install to a sane directory like: C:\MinGw64.

now go to compiler options under settings in Code::Blocks and in the tab ToolChain executables:

Set the complier's installtion directory to be:  C:\MinGw64\mingw32 or C:\*insert_installation directory\mingw32

For the next part taken liberally from: http://forums.codeblocks.org/index.php?topic=13016.0

C compiler: gcc.exe
C++ compiler: g++.exe
Linker for dynamic libs: g++.exe
Linker for static libs: ar.exe
Debugger: There isn't one for MinGW 64-bit yet, clear this and leave it blank
Resource compiler: windres.exe
Make program: mingw32-make.exe(it says make.exe in the post but it doesn't exist in the version I downloaded).

Then finally under Project/build options/ pre/post build steps take out those pre-build arguments.

This worked for me....

Offline Random_dragon

  • Survivor
  • ***
  • Posts: 6391
  • Psycho bored dragon.
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #16 on: November 23, 2015, 05:48:19 AM »
Yay, so I'm not the only one that can't ever get the official instructions to work. o3o

Offline Frostwood

  • NPC
  • **
  • Posts: 107
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #17 on: November 23, 2015, 04:52:58 PM »
Yay, so I'm not the only one that can't ever get the official instructions to work. o3o

The official instructions used to work, but then the decision was made to update the compiler requirements to C++11, and replacing the code::blocks version with the latest version of MinGW(8.1) used to work, but the requirements were changed to require gcc(9.1++), and the MinGW project only goes to 8.1.

The information to install a more recent version is scattered across the four corners of the internet.  I wonder if we should do an updated post with the more recent information.

Offline Random_dragon

  • Survivor
  • ***
  • Posts: 6391
  • Psycho bored dragon.
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #18 on: January 26, 2016, 10:14:54 PM »
Code: [Select]
Running project pre-build steps
cmd /c git --version || echo 'git' command not found!
'git' is not recognized as an internal or external command,
operable program or batch file.
'git' command not found!
cmd /c for /F "tokens=*" %i in ('git describe --tags --always --dirty') do echo #define VERSION "%i" >  src/version.h
'git' is not recognized as an internal or external command,
operable program or batch file.
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Here we go again.

Offline Malkeus

  • Survivor
  • ***
  • Posts: 602
  • Master Necroposter
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #19 on: January 26, 2016, 10:43:20 PM »
It looks like your git install directory is not in your windows PATH.
Figure out the full path to where you installed git, open your computer properties and find the advanced button, look for the PATH variable in the lower part of the screen, edit it and append ";<gitpath>" to the existing path.

I can't be more specific right now as I'm not on my home system, but that's what that error means. Just don't forget the semi-colon between the last entry and <gitpath>.

Offline Random_dragon

  • Survivor
  • ***
  • Posts: 6391
  • Psycho bored dragon.
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #20 on: January 26, 2016, 10:46:42 PM »
Hmm. Where are I appending the path info to? A setting in Code::Blocks I assume?

Offline Malkeus

  • Survivor
  • ***
  • Posts: 602
  • Master Necroposter
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #21 on: January 27, 2016, 01:00:10 AM »
Nope, it's a windows system variable. This page should walk you through it much better than I can: https://www.java.com/en/download/help/path.xml

Offline NominalNuance

  • Zombie Food
  • *
  • Posts: 10
  • Wow.
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #22 on: February 24, 2016, 11:40:17 AM »
I'm running into a similar problem as Random_dragon. I made sure that there was a proper gitpath and everything. I'm kinda at a loss.

Code: [Select]
Running project pre-build steps
cmd /c git --version || echo 'git' command not found!
git version 2.7.2.windows.1
cmd /c for /F "tokens=*" %i in ('git describe --tags --always --dirty') do echo #define VERSION "%i" >  src/version.h
fatal: Not a git repository (or any of the parent directories): .git
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))


Offline Random_dragon

  • Survivor
  • ***
  • Posts: 6391
  • Psycho bored dragon.
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #23 on: February 24, 2016, 05:54:09 PM »
I eventually got it working. For what little good it's doing now.

Offline wad67

  • Survivor
  • ***
  • Posts: 356
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #24 on: March 08, 2016, 08:09:40 AM »
I can't get any of this to work at all, Still getting the 'git' errors.

I don't feel like installing linux just to compile cataclysm today.

Is there an up to date guide for codeblocks anywhere?

I have attempted the updated guide on the wiki

http://www.wiki.cataclysmdda.com/index.php?title=How_to_compile#Updated_guide_.28incomplete_but_results_in_working_executable.29


I'm getting the same error regarding 'git'




Removing the offending git <extracommand> thingy seems to have worked.
http://smf.cataclysmdda.com/index.php?topic=11414.0

I can only compile the non SDL, no lua, No localisation though. Deps are too hard to find due to scatterbrained documentation.
« Last Edit: March 08, 2016, 08:52:03 AM by wad67 »

Offline Litppunk

  • Survivor
  • ***
  • Posts: 3771
  • Hi, carefull I hear THAT guy is around here....
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #25 on: March 08, 2016, 07:06:29 PM »
Just a spot saver post. Keeping track of things, and hopefully finding this thread again latter. Than you for your patience. Ill be going now.
Don't mind me just passing through....
A punk is a smoldering stick used for lighting firework fuses, dynamite and other fused items. This makes it the source of raging fires and destruction, and the ignition of beautiful displays of pyrotechnics and many beneficial flames as well a pranksters tool.
hey.... whats that hissing sound.

Offline Soyweiser

  • Survivor
  • ***
  • Posts: 864
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #26 on: July 04, 2016, 04:04:11 AM »
I got it running easily enough. Some files are missing from the codeblocks project file (and had to do the 'remove the git call' editing). And I have only been trying the console version so far. But it seems to work a lot better than before.

Didn't even need to download mingw, as the newest version of codeblocks seemed to work.

Here is my guide:
* Install codeblocks ( codeblocks-16.01mingw-setup.exe )
* Download the most recent github CDDA code. (I lied, I didn't do this, I already have git running, and copied my own clone of CDDA, but that is a bit more advanced).
* Unpack the github code in a project directory somewhere. (Not in the same directory as codeblocks (codeblocks is the tool, that works on your 'canvas' that is the CDDA code)
* Open codeblocks and open the projectfile from the CDDA github code. (CataclysmWin.cbp)
* In codeblocks go to 'settings' 'compiler', with the selected compiler 'GNU GCC Compiler' select the checkbox 'Have g++ follow the C++11 ISO C++ Language standard [-std=c++11]'. (Else I got a warning about a const constexp something).
* Try to build the project.
* See the warning about some sort of git problem
* Do this: http://smf.cataclysmdda.com/index.php?topic=11414.msg252569#msg252569
* Build the project.
* Get several unhelpful errors. (Red errors without references to specific lines of code, this means the compiler has no problems, but the linker has. Which means some files are probably missing from the project code).
* Ideally now find the specific files missing from the code. (In my case it was 'emit.cpp' and 'emit.h'). But a brute force method is to go to the project tab (default on the left: http://prntscr.com/boh1t1 ). Right click on the src file, select 'add files'. Select all the .cpp and .h files. And add them all.
* Build, and wait for the program to compile without errors.
* Select run (http://prntscr.com/boh31r). And see CDDA in console mode game screen pop up.

This worked for me. Hope it helps.
"Put me in charge and you'll have finished and polished game with hundreds more new features within two months." -- Lazycat
"Voker57 just was wondering about when did cata turn into contact lenses user simulator"

Offline The13thRonin

  • Zombie Food
  • *
  • Posts: 21
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #27 on: October 09, 2016, 04:54:20 AM »
I got it running easily enough. Some files are missing from the codeblocks project file (and had to do the 'remove the git call' editing). And I have only been trying the console version so far. But it seems to work a lot better than before.

Didn't even need to download mingw, as the newest version of codeblocks seemed to work.

Here is my guide:
* Install codeblocks ( codeblocks-16.01mingw-setup.exe )
* Download the most recent github CDDA code. (I lied, I didn't do this, I already have git running, and copied my own clone of CDDA, but that is a bit more advanced).
* Unpack the github code in a project directory somewhere. (Not in the same directory as codeblocks (codeblocks is the tool, that works on your 'canvas' that is the CDDA code)
* Open codeblocks and open the projectfile from the CDDA github code. (CataclysmWin.cbp)
* In codeblocks go to 'settings' 'compiler', with the selected compiler 'GNU GCC Compiler' select the checkbox 'Have g++ follow the C++11 ISO C++ Language standard [-std=c++11]'. (Else I got a warning about a const constexp something).
* Try to build the project.
* See the warning about some sort of git problem
* Do this: http://smf.cataclysmdda.com/index.php?topic=11414.msg252569#msg252569
* Build the project.
* Get several unhelpful errors. (Red errors without references to specific lines of code, this means the compiler has no problems, but the linker has. Which means some files are probably missing from the project code).
* Ideally now find the specific files missing from the code. (In my case it was 'emit.cpp' and 'emit.h'). But a brute force method is to go to the project tab (default on the left: http://prntscr.com/boh1t1 ). Right click on the src file, select 'add files'. Select all the .cpp and .h files. And add them all.
* Build, and wait for the program to compile without errors.
* Select run (http://prntscr.com/boh31r). And see CDDA in console mode game screen pop up.

This worked for me. Hope it helps.

This worked great! But it didn't compile the tile version?

Are we able to compile the tile version?

Offline Aggregate

  • Zombie Food
  • *
  • Posts: 3
    • View Profile
Re: Newby Guide to Compiling (and Editing) With Code::Blocks
« Reply #28 on: December 29, 2016, 05:37:44 AM »
Yes, a guide for compiling the Tiles version would be nice.
FEAST