Code::Blocks is a free, open-source cross-platform IDE that supports various compilers.
DreamSDK is a modern, ready-to-use environment for the Sega Dreamcast development, designed for the Microsoft Windows platform. It's a package composed by a lot of pre-compiled tools; and Code::Blocks is a nice IDE which unleash the power of DreamSDK.
This repository hold a special version of the official Code::Blocks 25.03 stable release modified for adding full support of DreamSDK.
If you are interested about Code::Blocks but not in Sega Dreamcast development using DreamSDK, you may use the official Code::Blocks release then. But if you are interested in Sega Dreamcast development using DreamSDK AND regular development, you can use this special edition of Code::Blocks without any issue, as the changes performed in this fork are not destructive, they only applies in DreamSDK profile.
Notables changes of this special release of Code::Blocks includes:
- New compiler/options file (
dc-gcc
) which specify theGNU GCC Compiler for Sega Dreamcast
compiler. - The
compiler
anddebugger
plugins have been patched to run the loader (i.e.dc-tool
) before running the target. - The
Sega Dreamcast Project
(dc
) wizard template has been added.
The changes are located in the Code:Blocks source in the sdk
, Compiler
and Debugger
projects.
The new sdk
(codeblocks.dll
) module is needed to expose the required CallHooks()
function in the Squirrel script (used to refresh the IDE while using the dc
profile), that's why almost all compiled binaries are provided in the generated patch.
This repository will allow you to build Code::Blocks 25.03 for embedding it in the Code::Blocks Patcher for DreamSDK.
Code::Blocks 25.03 is available in both 32-bits and 64-bits. You will need to build both versions from the same source. Unlike Code::Blocks 17.12 or 20.03, Code::Blocks 25.03 does not support Windows XP: it only works with Windows 10 and later.
In summary, the goal of this repository is to generate the following packages:
.\packager\dist\codeblocks-25.03-dreamsdk-addon-bin-x86.7z
for 32-bit;.\packager\dist\codeblocks-25.03-dreamsdk-addon-bin-x64.7z
for 64-bit.
This package will be embedded in the Code::Blocks Patcher for DreamSDK (codeblocks-patcher.exe
).
This patcher is available in the Code::Blocks Patcher for DreamSDK repository.
This section contains instructions to follow after the initial cloning is complete. Install all the prerequisites below before trying to work with this repository. Some are provided for convenience while others must be downloaded manually.
These are provided directly in this repository, under the tools
directory:
- GCC 14.2.0 (with POSIX threads) + LLVM/Clang/LLD/LLDB 19.1.7 + MinGW-w64 12.0.0 UCRT from WinLibs
- Zip 3.00 from Info-ZIP.
- Ultimate Packer for eXecutables (UPX).
These are not provided in this repository but could be easily downloaded:
- 7-Zip.
- Boost 1.87.0.
- Code::Blocks (yes, for building Code::Blocks you will need Code::Blocks).
- DreamSDK (this is not required for building Code::Blocks but will be for testing the special release that we will build using this repository).
Just unzip the 2 WinLibs toolchains in the drive root, usually C:\
:
- 64-bit will be unzipped in
C:\mingw64
- 32-bit will be unzipped in
C:\mingw32
- Make sure
zip
andupx
are available in yourPATH
variable. - Install 7-Zip using the default settings and make sure
7z
is available in yourPATH
variable. - Download Code::Blocks without the embedded compiler, as we will use our own. Install it with the default settings. It's easiest to install Code::Blocks in 64-bit if you plan to compile the 64-bit version (i.e.,
codeblocks-25.03-setup.exe
); do the same for the 32-bit version (i.e.,codeblocks-25.03-32bit-setup.exe
), although it's not required. This document will assume you'll follow this rule. - Install DreamSDK using the default settings.
After installing all the prerequisites, you need to build wxWidgets for Windows, i.e. wxMSW. You only need to do that once; fortunately because this process is really very long.
- Open the
.\wxMSW\build.ini
file and adapt it as needed. - Double-click on the
.\wxMSW\build.cmd
file.
The .\wxMSW\bin
directory will be created, that will contains both debug
and release
wxWidgets for Windows builds, both on 32-bit and 64-bit flavours.
Boost is used for some plugins in Code::Blocks, for example for the Nassi–Shneiderman plugin.
This section explains how to install Boost for Code::Blocks; and it assumes that the 64-bit version is the one that will be built.
-
Unzip boost 1.87.0. The location where Boost is unzipped is called officially
$BOOST_ROOT
. Usually,$BOOST_ROOT
will be set asC:\Program Files\boost\boost_1_87_0
, but it could beC:\boost_1_87_0
or whatever you want. -
Open a Windows Command prompt.
-
Enter the following commands:
set WINLIBS_ROOT=C:\mingw64 set CODEBLOCKS_ROOT=C:\Program Files\CodeBlocks set BOOST_ROOT=C:\Program Files\boost\boost_1_87_0 set PATH=%WINLIBS_ROOT%\bin\;%PATH% cd /D %BOOST_ROOT% bootstrap gcc b2 install --toolset=gcc "--prefix=%CODEBLOCKS_ROOT%" boost.stacktrace.from_exception=off
After running those commands, Boost is indeed installed. Now we need to configure Code::Blocks IDE, as explained below.
To build Code::Blocks you will indeed need Code::Blocks. Install the IDE without the embedded MinGW compiler (as it isn't needed) then unzip both WinLibs toolchains if not already done (see above). Now, it's necessary to configure Debuggers and Compilers in Code::Blocks.
As always, this section assumes that you are setting up things for 64-bit, but adjust the settings if necessary.
- Select the Settings > Debugger menu item in Code::Blocks.
- Click on GDB/CDB debugger then Default.
- In Executable path, input the correct GNU Debugger (GDB) binary:
C:\mingw64\bin\gdb.exe
- Click OK.
Result:
Note: This part has been written using the WinLibs official guide as base.
- Select the Settings > Compiler menu item in Code::Blocks.
- Select the GNU GCC Compiler (default) profile in the list if not already done.
- Click on Toolchain eXecutables and input
C:\mingw64
in Compiler's installation directory. - In the Program files sub-tab, input the following:
- C compiler:
x86_64-w64-mingw32-gcc.exe
- C++ compiler:
x86_64-w64-mingw32-g++.exe
- Linker for dynamic libraries:
x86_64-w64-mingw32-g++.exe
- Linker for static libraries:
x86_64-w64-mingw32-gcc-ar.exe
- Debugger: Select
GDB/CDB debugger: Default
as configured before - Resource compiler: This won't be used but you can set
windres.exe
here - Make program:
mingw32-make.exe
- C compiler:
Result:
Then, select the options forcing the build of static binaries. If not doing so, you will be forced to redistribute MinGW-w64 runtime libraries (DLL), something that we don't want for Code::Blocks.
- Click on Compiler settings tab.
- The General section should be displayed. Scroll down in the window, then tick the following boxes:
Static libgcc [-static-libgcc]
Static libstdc++ [-static-libstdc++]
Static linking [-static]
Result:
You can now validate the Compiler settings dialog by clicking OK.
After making this configuration, you can open the Code::Blocks IDE project in Code::Blocks.
Start Code::Blocks then open the .\codeblocks\codeblocks\src\CodeBlocks_wx32_64.workspace
file for 64-bit build or the CodeBlocks_wx32.workspace
file for 32-bit build.
As always in this document, we will consider that you want to build the 64-bit release, so we will open the CodeBlocks_wx32_64.workspace
file. This will open the CodeBlocks Workspace wx3.2.x (64 bit)
workspace in your Code::Blocks IDE.
The Global Variables window should be shown automatically, if not, select the Settings > Global Variables menu item in Code::Blocks. Select (or create) the following variables:
- For the
wx32_64
variable:- In the
base
field, enter${root}\wxMSW\bin\${arch}\release
, where${root}
is the directory path where this repository is stored and${arch}
will bex86
orx64
(e.g.C:\codeblocks\wxMSW\bin\x64\release
if you cloned this inC:\codeblocks
). - In the
include
field, enter${root}\wxMSW\bin\${arch}\release\include
(e.g.,C:\codeblocks-25.03\wxMSW\bin\x64\release\include
) - In the
lib
field, enter${root}\wxMSW\bin\${arch}\release\lib
(e.g.,C:\codeblocks-25.03\wxMSW\bin\x64\release\lib
) - In the
bin
field, enter${root}\wxMSW\bin\${arch}\release\bin
(e.g.,C:\codeblocks-25.03\wxMSW\bin\x64\release\bin
)
- In the
- For the
cb_release_type
variable, enter-g -O0
in thebase
field. This means that we will first build a Code::Blocks Debug build (see below). - For the
boost
variable:- In the
base
directory field, enterC:\Program Files\CodeBlocks
. - In the
include
field, enterC:\Program Files\CodeBlocks\include\boost-1_87
. - In the
lib
field, enterC:\Program Files\CodeBlocks\lib
.
- In the
Here is an example of the Global Variables window filled in:
Note regarding wx32_64: In practice, we will use only the release
build of wxMSW, as we won't debug wxMSW itself. But if for some reasons, you want to use the Debug builds of wxMSW, then input ${root}\wxMSW\bin\${arch}\debug
in base
field (and do the adaptations for the rest). You will need to update the WX_SUFFIX
project variable in all projects using wxMSW:
- Click on Project > Build options....
- Click on the Custom Variables tab.
- In the Variables list, select the
WX_SUFFIX
variable and click on Edit. - In the Value field, input
ud
(for Unicode/Debug). - Validate everything by clicking OK.
This WX_SUFFIX
variable need to be updated on all projects using wxMSW, so it could be really long to update.
You can now try to build Code::Blocks IDE in Debug mode.
Again, this part of the document assumes that 64-bit Code::Blocks will be built under WinLibs MinGW 64-bit toolchain.
- Open the
.\codeblocks\codeblocks\src\CodeBlocks_wx32_64.workspace
if not already done. - Select the Settings > Global Variables menu item, select the
cb_release_type
variable and enter-g -O0
in thebase
field, if not already done. - Rebuild the the whole workspace. Basically, you may right-click in the
CodeBlocks Workspace wx3.2.x (64 bit)
root node and select Rebuild workspace. - The debug build is stored in
.\codeblocks\src\devel32_64
.
You will have to copy the wxMSW libraries now, but this will be done only once (or as soon as you have to rebuild wxMSW for some reason). Copy the wxmsw32u_gcc_custom.dll
and wxmsw32u_gl_gcc_custom.dll
files in the .\codeblocks\src\devel32_64
directory. If you are using Debug release of wxMSW, then of course you will copy the wxmsw32ud_gcc_custom.dll
and wxmsw32ud_gl_gcc_custom.dll
files instead.
If you want to debug the Code::Blocks build, you must first install a DreamSDK working package in C:\DreamSDK\
. If you don't have an C:
drive (really?!), you have to do some changes:
- Change the
DREAMSDK_HOME_DEBUG_DRIVE
variable in.\packager\mkpkg.cmd
. - Change the
C:
drive reference in the 2 files below:.\codeblocks\src\plugins\compilergcc\resources\compilers\compiler_dc-gcc.xml
.\codeblocks\src\plugins\compilergcc\resources\compilers\options_dc-gcc.xml
- You can now run/debug the produced Code::Blocks IDE by using the left or right arrows in the toolbar.
- In the debugged Code::Blocks (and NOT your regular Code::Blocks you used to build this special edition!), go to the Settings > Compiler menu, select the GNU GCC Compiler for Sega Dreamcast profile and click on Reset defaults. Code::Blocks should detect the DreamSDK package environment used for debug your Code::Blocks build.
-
Open the
.\codeblocks\codeblocks\src\CodeBlocks_wx32_64.workspace
if not already done. -
Select the Settings > Global Variables menu item then select the
cb_release_type
variable and enter-O2
in thebase
field. -
Change the content of the
.\codeblocks\src\include\autorevision.h
file. In normal conditions, this file is created automatically when using SVN and theautorevision
tool. Or you may just create thisautorevision.h
file manually. The SVN revision13644
is the official revision for the25.03
release./*13644*/ //don't include this header, only configmanager-revision.cpp should do this. #ifndef AUTOREVISION_H #define AUTOREVISION_H #include <wx/string.h> namespace autorevision { const unsigned int svn_revision = 13644; const wxString svnRevision(_T("13644")); const wxString svnDate(_T("YYYY-MM-DD hh:mm:ss")); // update manually the date/time using this format } #endif
-
Rebuild the the whole workspace. Basically, you may right-click in the
CodeBlocks Workspace wx3.2.x (64 bit)
root node and select Rebuild workspace. -
Run the
.\codeblocks\src\update32_64.bat
file.
The release build is stored in .\codeblocks\src\output32_64
.
Note: The wxMSW libraries are automatically copied from devel32_64
, so you don't have to manually copy these libraries.
After building the Code::Blocks release, you need to build the package that will be embedded in the Code::Blocks Patcher for DreamSDK.
- Follow the instructions for building a Release build (see above), if not already done.
- Go to the
.\packager
directory. - From there, run the
mkpkg.cmd
file.
Sometimes, the breakpoints are never reached. Please verify you made a Debug build of Code::Blocks by checking the cb_release_type
global variable: it should be set to -g -O0
in order to activate debug symbols.
This message is sometimes shown when starting the debug build of Code::Blocks. It caused by missing image files in the .\codeblocks\src\devel\share\CodeBlocks\images\
directory.
To solve this issue, you just have to run the .\codeblocks\src\update32_64.bat
file, this will copy the missing files to the devel32_64
and output32_64
directories.