Difference between revisions of "Codeblocks setup"

From The Powder Toy
Jump to: navigation, search
(MinGW Preparation)
m (Fixed links.)
Line 7: Line 7:
 
Environmental variable instuctions by pilojo.
 
Environmental variable instuctions by pilojo.
  
Last modified: 5/21/2011
+
Last modified: 10/28/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.
+
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.
+
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 and Install [http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/| MinGW] using the default settings (Or install C++ compiler also, just to be sure).
* Add C:\MinGW\bin; to the PATH environment variable
+
* Add <code>"C:\MinGW\bin"</code> to the PATH environment variable, without quotes.
* Download SDL [[http:'www.libsdl.org/release/SDL-devel-1.2.14-mingw32.tar.gz| here]] and bzip2 [[http:''gnuwin32.sourceforge.net/downlinks/bzip2-bin-zip.php| here]] and regex [http://gnuwin32.sourceforge.net/downlinks/regex-bin-zip.php| here]
+
* Download the following libraries: [http://code.google.com/p/luaforwindows/downloads/list| LuaForWindows,] [http://www.libsdl.org/release/SDL-devel-1.2.14-mingw32.tar.gz| SDL,] [http://gnuwin32.sourceforge.net/downlinks/bzip2-bin-zip.php| bzip2,] [http://gnuwin32.sourceforge.net/downlinks/regex-bin-zip.php| regex,] and [ftp://sourceware.org/pub/pthreads-win32/pthreads-2005-03-08.exe| pthreads-win32.]
* Extract the folders in these files to C:\MinGW\ so that it coincides to the bin, lib, and include folders of the MinGW installation.
+
* Extract the libraries contents C:\MinGW\ so it overlaps the bin, lib, and include folders. Don't do this with LuaForWindows, leave it to the default place.
  
 
(If you don't know what an environmental variable is, here is how to get to it.)
 
(If you don't know what an environmental variable is, here is how to get to it.)
Line 27: Line 27:
 
* 5. Second box, scroll down till you see PATH.
 
* 5. Second box, scroll down till you see PATH.
 
* 6. Click PATH, then click Edit.
 
* 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; .
+
* 7. If there is not a semi-colin at the end of the line, add one and then add <code>"C:\MinGW\bin"</code> without quotes.
* 8. Hit ok
+
* 8. Press OK
 
* 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 and Install Code::Blocks [http://prdownload.berlios.de/codeblocks/codeblocks-10.05-setup.exe| here]
* Install Code::Blocks
 
 
* In the first run, you will be asked what compiler to use. Select "MinGW" or "GNU GCC Compiler".
 
* In the first run, you will be asked what compiler to use. Select "MinGW" or "GNU GCC Compiler".
 
* Code::Blocks is now ready!
 
* Code::Blocks is now ready!
  
==  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.
 
* [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.
 
 
==  Preparing the project  ==
 
==  Preparing the project  ==
 +
* Download [https://github.com/FacialTurd/The-Powder-Toy/zipball/master| this] and put it in an empty folder.
 +
* Open Code::Blocks
 
* 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 47: Line 44:
 
* Click the Select All button
 
* Click the Select All button
 
* Now, the tricky part. Go to Project -> Build options -> Linker settings. Add the following in the link libraries:
 
* 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\libmingw32.a
 
+
C:\MinGW\lib\libSDLmain.a
C:\MinGW\lib\libSDLmain.a
+
C:\MinGW\lib\libSDL.dll.a
 
+
C:\MinGW\lib\bzip2.lib
C:\MinGW\lib\libSDL.dll.a
+
C:\MinGW\lib\libwsock32.a
 
+
C:\MinGW\lib\libws2_32.a
C:\MinGW\lib\bzip2.lib
+
C:\MinGW\lib\libregex.dll.a
 
+
C:\Program Files\Lua\5.1\lib\lua5.1.lib
C:\MinGW\lib\libwsock32.a
+
C:\MinGW\lib\libpthread.dll.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:
 
* Next, paste this into Other Linker Options, to the right of link libraries:
Line 71: Line 60:
 
* Now go to Search directories -> Compiler, still in Build Options. Add the following:
 
* 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)
+
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\SDL
+
C:\MinGW\include\
 
 
C:\MinGW\include\
 
  
 
* The last one. In Compiler Settings -> Other options, still in Build Options, Add the line:
 
* 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
+
-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, post in the HELP secton on the forums with a [http://www.pastebin.com paste bin] of your compiling error
+
* It should compile. If not, post in the HELP secton on the forums with a [http://pastebin.com/| pastebin] of your compiling error
* If it compiles continue to the element coding tutorial.
+
* If it compiles continue to the [[Coding-tutorial|element coding tutorial.]]
  
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 21:51, 28 October 2011

Author: tian110796

Fixed by macweirdo for Version 47 (Python Console Fixes)

Some parts are from JojoBond.

Environmental variable instuctions by pilojo.

Last modified: 10/28/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 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, without quotes.
  • Download the following libraries: LuaForWindows, SDL, bzip2, regex, and pthreads-win32.
  • Extract the libraries contents C:\MinGW\ so it overlaps the bin, lib, and include folders. Don't do this with LuaForWindows, leave it to the default place.

(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 not a semi-colin at the end of the line, add one and then add "C:\MinGW\bin" without quotes.
  • 8. Press OK
  • 9. Continue tutorial.

Code::Blocks preparation

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

Preparing the project

  • Download this and put it in an empty folder.
  • Open Code::Blocks
  • 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:\Program Files\Lua\5.1\lib\lua5.1.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, post in the HELP secton on the forums with a pastebin of your compiling error
  • If it compiles continue to the element coding tutorial.