Windows中CodeBlocks的使用,之前安装过,不过因为没有设置好,导致无法运行、无法调试,当时遂放弃。

昨天探索了一番,运行成功,记录如下。本例环境为Win10 x64。

1. 下载

https://www.fosshub.com/Code-Blocks.html?dwl=codeblocks-17.12-setup.exe

选择带编译器和调试器的版本:

Windows中CodeBlocks的使用_Windows

2. 编译器的设置(Complier)

Windows中CodeBlocks的使用_Windows_02

新建一个控制台程序(C语言),然后点绿色的Build and run按钮  Windows中CodeBlocks的使用_Windows_03 ,如果正常运行,则说明编译器已设置好。如果报错,则需要重新设置:

Settings -> Complier -> Toolchain Executables -> Auto-detect

Windows中CodeBlocks的使用_Windows_04

3. 调试器的设置(Debugger)

点击红色的Debug按钮Windows中CodeBlocks的使用_Windows_05,顺利执行,则说明编译器已设置好。如果报错,则需要重新设置:

Settings -> Debugger ->  GDB/CDB debugger -> Default -> Executable path

浏览目录,选择CodeBlocks安装目录中 MinGW\bin子目录下的gdb32.exe

Windows中CodeBlocks的使用_Windows_06

然后就能设置断点进行调试了。

Windows中CodeBlocks的使用_Windows_07