Nightly builds have new and better features then the stable releases which are needed. It is better to use nightly build, but check comments in forum if a new, nightly build has bugs, in which case wait for another one.
———————————————————————————–
Install Codeblocks Nightly Build –
———————————————————————————–
search “codeblocks nightly” in google
click on build you want to download like –
The 06 August 2013 build is out
Example zip or 7z file names in bracket changes with various releases.
How to use a nightly build – codeblocks forum post
download –
1) CB nightly, (CB_20130806_rev9246_win32.7z)
2) mingwm10.dll, when no MingW installed on your system, (mingwm10_gcc471-TDM.7z)
3) wxmsw28u_gcc_cb.dll, unicode windows wxWidget dll for Code::Blocks, (wxmsw28u_gcc_cb_wx2812_gcc471-TDM.7z)
4) exchndl.dll, exception handler dll (for better crash reports), (exchndl_gcc471-TDM.7z)
from build download page.
Final steps :
1) unzip the CB nightly in some directory
2) unzip all dll’s : requirement : they need to be in your PATH, most easiest is to unzip both of them into the same directory where you unzipped the nightly, so they reside next to the codeblocks.exe .
———————————————————————————–
Install GCC Compiler 32 bit and 64 bit TDM-GCC
———————————————————————————–
Download MinGW-w64
GCC 7 (latest) (GCC for Windows 64 & 32 bits [mingw-w64]) or GCC 6 (stable). Use x86_64-win32-seh (64 bit, SEH exceptions, win32 threads), for using std::threads with it you can use mingw-std-threads (meganz/mingw-std-threads) with it. or you can use x86_64-posix-seh for using pthreads (unix threads) and std:threads built on pthreads but you will need to distribute winpthreads-1.dll with your exe.
extract or install to –
For example all files inside “x86_64-7.1.0-release-win32-seh-rt_v5-rev2.7z” go to “E:\osl\codeblocksn\codeblocks” folder directly.
Download TDM-GCC
search – “TDM-GCC” in google
http://tdm-gcc.tdragon.net/
download 32bit and 64bit versions (Bundle Installer) – install in some directory (outside codeblocks directory)
while installing –
Uncheck checkbox “Check for updated files on the TDM-GCC server”
In next screen
select “Components –
select “gcc”, or expand it and select “openmp”
select “gdb”
Meaning select all compnents for both 32 bit and 64 bit TDM-GCC, so that everything is installed
extract or install to –
For example all files inside “CB_20130806_rev9246_win32.7z” go to “E:\osl\codeblocksn\codeblocks” folder directly.
Example install path –
E:\osl\codeblocksn\codeblocks (CB_20130806_rev9246_win32.7z), (mingwm10_gcc471-TDM.7z), (wxmsw28u_gcc_cb_wx2812_gcc471-TDM.7z), (exchndl_gcc471-TDM.7z)
E:\osl\codeblocksn\MinGW32 (tdm-gcc-4.7.1-2.7z)
E:\osl\codeblocksn\MinGW64 (tdm64-gcc-4.7.1-3.7z)
clang
You can even setup clang(Clang – Getting Started) compiler with CodeBlocks.
———————————————————————————–
Codeblocks settings for New GCC Compilers
———————————————————————————–
(*** settings are only need to be modified generally but check all)
(set these settings) – browse to MinGW64 directory or, just copy the name of executables from this text file and paste in appropriate boxes in settings page.
After installing start codeblocks –
codeblocks –
codeblocks –
32 bit
————–
Settings – Compiler –
Selected Compiler – GNU GCC Compiler – ([copy], if you want to make another compiler but is not required, for 32 bit, just modify path and check c++ compiler which is wrongly
named to “mingw32-g++.exe” instead of “mingw32-c++.exe”)
Toolchain executables –
*** Compiler’s installation directory – E:\osl\codeblocksn\MinGW32 (your path here)
these are set, just check –
browse to MinGW32 directory –
(set these settings)
C compiler – mingw32-gcc.exe
*** C++ compiler – mingw32-c++.exe
Linker for dynamic libs – mingw32-g++.exe
Linker for static libs – ar.exe
Debugger – GDB/CDB debugger : Default
Resource Compiler – windres.exe
Make program – mingw32-make.exe
codeblocks –
64 bit
————–
Settings – Compiler –
*** Selected Compiler – GNU GCC Compiler – [copy]
*** Give Name – GNU GCC Compiler x64
Toolchain executables –
*** Compiler’s installation directory – E:\osl\codeblocksn\MinGW64 (your path here)
browse to MinGW64 directory –
(set these settings)
*** C compiler – x86_64-w64-mingw32-gcc.exe
*** C++ compiler – x86_64-w64-mingw32-c++.exe
*** Linker for dynamic libs – x86_64-w64-mingw32-g++.exe
Linker for static libs – ar.exe
Debugger – GDB/CDB debugger : Default
Resource Compiler – windres.exe
Make program – mingw32-make.exe
*** [Set as default] (the 64 bit compiler or 32 bit if you want that)
———————————————————————————–
Codeblocks settings for ease of use
———————————————————————————–
Keyboard Shortcuts –
——————–
Settings – Editor – Keyboard Shortcuts –
File – Save Everything – Ctrl + Shift + S
Menu bar – Build –
Build – Ctrl + F9
Run – Ctrl + F10
*** Build and run – F9, *** F5
Rebuid – Ctrl + F11
*** Build workspace – F6
*** Rebuild workspace – F7
These settings will help a lot if you work in both Visual Studio and Codeblocks side by side
Syntax Highlighting like Visual Studio –
—————————————-
Settings – Editor – Syntax highlighting
Comment (normal), Comment line (normal) – select dark green
Keyword, User Keyword – light dark blue
String, Preprocessor – maroon
Selection – light blue
Drag Project Management box in editor to right hand side.
Keep Codeblocks settings –
———————
Codeblocks settings (what you just did) are stored in “C:\Users\(user_name)\AppData\Roaming”
When you use a new nightly build by deleting previous folders and extracting new zip or 7z files,
if you are asked to update default settings select no (all the time) so as to keep compiler settings,
or set them manually like above if you selected yes.
———————————————————————————–
Codeblocks Programming and project setting related tips
———————————————————————————–
Save Workspace like Solution files –
————————————
File – New – Project
Then
File – Save workspace as (save where your project file is, you can add other project files in this workspace also)
All projects are saved in default workspace. By this you can save own workspace which is equal to solution file in Visual Studio.
UNICODE
————–
#define UNICODE //for Windows API functions
#define _UNICODE //for C runtime functions
in source code using compiler #ifdef condition
or define in
“Project build options – Compiler settings – #defines”
Example –
WIN32
_WIN64 (added manually for only 64 bit configurations, same in Visual Studio also in “Project Properties – C/C++ – preprocessor” options)
UNICODE
_UNICODE
_WINDOWS
_CRT_SECURE_NO_DEPRECATE
__GNUWIN32__
including static libs
———————
#pragma comment(lib, “OpenGL32.lib”)
is for visual studio
#pragma does not work in codeblocks for gcc
for adding static lib like directx9 “d3d.lib”
(currently does not work while adding from project settings)
(Found this by comparing own project file with the default d3d9 project generated by codeblocks)
Open project file, “project_name.cbp”
go to –
<Linker>
<Add library=”d3d9″ />
</Linker>
It will look something like this
<Linker>
<Add library=”winmm” />
<Add library=”opengl32″ />
<Add library=”gdi32″ />
<Add library=”d3d9″ />
</Linker>
<Unit filename=”win_api_basic_dx9.cpp” />