Difference between revisions of "Codeblocks setup"

From The Powder Toy
Jump to: navigation, search
m (1 revision)
(talk)
Line 14: Line 14:
 
Note: This tutorial works only in windows, but will work in Macintosh with minor changes.
 
Note: This tutorial works only in windows, but will work in Macintosh with minor changes.
  
===  MinGW Preparation  ===
+
==  MinGW Preparation  ==
 
* Download [http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/| here] and install MinGW using the default settings (Or install C++ compiler also, just to be sure).
 
* Download [http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/| here] and install MinGW using the default settings (Or install C++ compiler also, just to be sure).
 
* Add C:\MinGW\bin; to the PATH environment variable
 
* Add C:\MinGW\bin; to the PATH environment variable
Line 31: Line 31:
 
* 9. Continue tutorial.
 
* 9. Continue tutorial.
  
===  Code::Blocks preparation  ===
+
==  Code::Blocks preparation  ==
 
* Download Code::Blocks [http://prdownload.berlios.de/codeblocks/codeblocks-10.05-setup.exe| here]
 
* Download Code::Blocks [http://prdownload.berlios.de/codeblocks/codeblocks-10.05-setup.exe| here]
 
* Install Code::Blocks
 
* Install Code::Blocks
Line 37: Line 37:
 
* Code::Blocks is now ready!
 
* Code::Blocks is now ready!
  
===  Python Preparation  ===
+
==  Python Preparation  ==
 
* Go [http://www.python.org/download/releases/2.7.1/| here] and click on the Windows x86 MSI Installer (2.7.1) link, '''NOT''' the x64 version.
 
* Go [http://www.python.org/download/releases/2.7.1/| here] and click on the Windows x86 MSI Installer (2.7.1) link, '''NOT''' the x64 version.
 
* [http://github.com/FacialTurd/The-Powder-Toy| Download this (using the large download button] and put it in an empty folder.
 
* [http://github.com/FacialTurd/The-Powder-Toy| Download this (using the large download button] and put it in an empty folder.
 
* Run the script in it called getheader.py, wait for it to finish.
 
* Run the script in it called getheader.py, wait for it to finish.
===  Preparing the project  ===
+
==  Preparing the project  ==
 
* Create a new empty project.
 
* Create a new empty project.
 
* Create project in the folder where your source exists. (sometimes it adds to the directory the Project name, if that happens, remove the Project name part from the directory)
 
* Create project in the folder where your source exists. (sometimes it adds to the directory the Project name, if that happens, remove the Project name part from the directory)
Line 80: Line 80:
 
-w -m32 -std=c99 -D_POSIX_C_SOURCE=200112L -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations -mmmx -DX86 -mwindows -DWIN32
 
-w -m32 -std=c99 -D_POSIX_C_SOURCE=200112L -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations -mmmx -DX86 -mwindows -DWIN32
  
===  Compiling  ===
+
==  Compiling  ==
 
* Press F9 in your keyboard.
 
* Press F9 in your keyboard.
 
* It should compile. If not, Converse with tian110796, macweirdo, or cracker64
 
* It should compile. If not, Converse with tian110796, macweirdo, or cracker64
 
* If it compiles continue to the element coding tutorial.
 
* If it compiles continue to the element coding tutorial.

Revision as of 19:47, 28 September 2011

Author: tian110796

Fixed by macweirdo for Version 47 (Python Console Fixes)

Some parts are from JojoBond.

Environmental variable instuctions by pilojo.

Last modified: 5/21/2011


This is a guide for compiling using Code::Blocks with MinGW. This guide is targeted to those who are intimidated by the large Visual C++ Express download and is using windows.

Note: This tutorial works only in windows, but will work in Macintosh with minor changes.

MinGW Preparation

  • Download here and install MinGW using the default settings (Or install C++ compiler also, just to be sure).
  • Add C:\MinGW\bin; to the PATH environment variable
  • Download SDL here and bzip2 here and regex here
  • Extract the folders in these files to C:\MinGW\ so that it coincides to the bin, lib, and include folders of the MinGW installation.

(If you don't know what an environmental variable is, here is how to get to it.)

  • 1. Go to My Computer.
  • 2. System properties/settings.
  • 3. Advanced system settings.
  • 4. Environmental Variables.
  • 5. Second box, scroll down till you see PATH.
  • 6. Click PATH, then click Edit.
  • 7. If there is no " ; " at the end of the line, add one and then add C:\MinGW\bin; .
  • 8. Hit ok
  • 9. Continue tutorial.

Code::Blocks preparation

  • Download Code::Blocks here
  • Install Code::Blocks
  • In the first run, you will be asked what compiler to use. Select "MinGW" or "GNU GCC Compiler".
  • Code::Blocks is now ready!

Python Preparation

Preparing the project

  • Create a new empty project.
  • Create project in the folder where your source exists. (sometimes it adds to the directory the Project name, if that happens, remove the Project name part from the directory)
  • In the Management window you will see the project name listed there. Right-click then add files recursively.
  • Click the Select All button
  • Now, the tricky part. Go to Project -> Build options -> Linker settings. Add the following in the link libraries:

C:\MinGW\lib\libmingw32.a

C:\MinGW\lib\libSDLmain.a

C:\MinGW\lib\libSDL.dll.a

C:\MinGW\lib\bzip2.lib

C:\MinGW\lib\libwsock32.a

C:\MinGW\lib\libws2_32.a

C:\MinGW\lib\libregex.dll.a

C:\Python27\libs\python27.lib

C:\MinGW\lib\libpthread.dll.a

  • Next, paste this into Other Linker Options, to the right of link libraries:

-static-libgcc -static-libstdc++

  • Now go to Search directories -> Compiler, still in Build Options. Add the following:

includes* (note: if you get air.h not found, try adding the full path to the includes folder)

C:\MinGW\include\SDL

C:\MinGW\include\

  • The last one. In Compiler Settings -> Other options, still in Build Options, Add the line:

-w -m32 -std=c99 -D_POSIX_C_SOURCE=200112L -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations -mmmx -DX86 -mwindows -DWIN32

Compiling

  • Press F9 in your keyboard.
  • It should compile. If not, Converse with tian110796, macweirdo, or cracker64
  • If it compiles continue to the element coding tutorial.