已有MinGW的下载codeblocks-?.?-setup.exe
便可,尚未的推荐直接下载codeblocks-?.?mingw-setup.exe
。php
添加环境变量:html
Path += %MinGW%\bin;%MinGW%\mingw32\bin;
MinGW以后编译Code::Blocks要用。ios
At the present time, Code::Blocks only compiles successfully with the MinGW compiler (or any other gcc for that matter).c++
svn: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk编程
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1
编译详见参考2,过程会比较久。能够直接下载预编译好的,在这儿。windows
For Windows, we also provide the pre-compiled wxWidgets, ...app
本身编译的话,就直接上wxWidgets3.0,参考5.1。ide
svn: svn://svn.code.sf.net/p/codeblocks/code/trunksvn
假设:函数
D:\codeblocks # Code::Blocks源码目录 D:\wxMSW-2.8.12 # 预编译wxWidgets解压目录
注意:3视状况,456不用依步骤,7随意。
而后:
能够卸载原先安装的C::B,用"output"下的迭代编译自身。
Settings -> Editor... -> General settings -> Editor settings -> Font > Choose -> F = YaHei Consolas Hybrid # 等宽字体 -> TAB options -> TAB size in spaces = 4 # TAB为4个空格 -> End-of-line options -> End-of-line mode = AUTO # 自动。 # 想选UNIX换行符LF,但如今换行符都由版本控制系统根据平台自动作转换了。 -> Other options -> Highlight line under caret # 高亮光标所在行 -> Other settings -> Encoding -> Use encoding when opening files = UTF-8 # 打开文件默认编码 -> Use this encoding: As default encoding # 默认编码 -> Other options -> Show spaces in editor = Always # 总显示空格 -> Margins and caret -> Right margin -> Right margin hint = Visible line # 右边界线可见 Edit -> File Encoding # 选择文件编码
新建Console application,因为Windows下Command Prompt不支持UTF-8,若是输出中文会是乱码。用的GCC编译器的话,能够设置-fexec-charset=GBK,即执行时字符集为GBK。更多选项。
Settings -> Compiler... -> Selected compiler = GNU GCC Compiler -> Compiler settings -> Other options: -fexec-charset=GBK
须要Rebuild后再Run。
main.cpp
#include <iostream> #include <string> #include <vector> template<typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { for (auto& el : vec) { os << el << ' '; } return os; } int main() { std::vector<std::string> words = { "Hello", "from", "GCC", __VERSION__, "!" }; std::cout << words << std::endl; }
Editor
功能 | 快捷键 |
---|---|
复制当前行 | Ctrl-D |
删除选中行 | Ctrl-L |
删除光标所在行 | Ctrl-Shift-L |
与上行交换 | Ctrl-T |
到上一段落 | Ctrl-[ |
到下一段落 | Ctrl-] |
撤销/Undo | Ctrl-Z |
恢复/Redo | Ctrl-Shift-Z |
切换头文件与源文件 | F11 |
注释 | Ctrl-Shift-C |
取消注释 | Ctrl-Shift-X |
自动完成 | Ctrl-J |
切换书签 | Ctrl-B |
到上个书签 | Alt-PgUp |
到下个书签 | Alt-PgDown |
Search
功能 | 快捷键 |
---|---|
查找 | Ctrl-F |
查找下个 | F3 |
查找上个 | Shift-F3 |
在文件中查找 | Ctrl-Shift-F |
替换 | Ctrl-R |
在文件中替换 | Ctrl-Shift-R |
到指定行 | Ctrl-G |
到下个被改变的行 | Ctrl-F3 |
到上个被改变的行 | Ctrl-Shift-F3 |
到指定文件 | Alt-G |
到指定函数 | Ctrl-Shift-G |
到上个函数 | Ctrl-PgUp |
到下个函数 | Ctrl-PgDown |
到声明处 | Ctrl-Shift-. |
到实现处 | Ctrl-. |
打开include文件 | Ctrl-Alt-. # 冲突,见5.1 |
到匹配括号 | Ctrl-Shift-B |
View
功能 | 快捷键 |
---|---|
显示/隐藏信息板 | F2 |
显示/隐藏管理板 | Shift-F2 |
上移工程 | Ctrl-Shift-Up |
下移工程 | Ctrl-Shift-Down |
激活上个项目 | Alt-F5 |
激活下个项目 | Alt-F6 |
Build
功能 | 快捷键 |
---|---|
Build | Ctrl-F9 |
编译当前文件 | Ctrl-Shift-F9 |
Run | Ctrl-F10 |
Build and Run | F9 |
Rebuild | Ctrl-F11 |
Debug
功能 | 快捷键 |
---|---|
切换断点 | F5 |
调试/继续 | F8 |
运行到光标处 | F4 |
单步下行代码 | F7 |
单步进入子函数 | Shift-F7 |
单步跳出子函数 | Ctrl-F7 |
单步下条指令 | Alt-F7 |
单步进入子指令 | Shift-Alt-F7 |
参考
location: D:\codeblocks\src\plugins\contrib\keybinder
修改快捷的插件,但只看到了wx3.0工程版本==。于是,仍是要准备下wxWidgets3.0。
注:plugins分为3类,contrib下是社区贡献的很是有价值的插件,因此整合到了SVN。见参考1。
2.1 修改config.gcc,防止链接时内存不够用。
CFLAGS ?= -fno-keep-inline-dllexport CXXFLAGS ?= -fno-keep-inline-dllexport
2.2 而后,以下编译wxWidgets3.0:
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 clean mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1
编译详看参考3,4。
同1.4,不过:
继而:
打开"D:\codeblocks\src\plugins\contrib\keybinder\keybinder_wx30.cbp"(注意还有其余区分),Build便可。
而后从新"update30.bat",从新打开C::B。在Settings > Editor...下多了Keyboard shortcuts,而后重定义吧。
把"Search > Open include file"改成"Ctrl-Alt-.",其与"Goto declaration"冲突。(r9741)
Linux上安装与编译,参考:CentOS安装Code::Blocks