1.11.12 查找破损文件(Find broken files)
如果一个文件已经从磁盘中删除,但它仍然被包含在项目文件(project.cbp)中(译者注:项目的文件信息保存在*.cbp文件里。),这个文件在项目面板中显示一个破损符号(如下图)。应该通过上下文菜单[Remove file from project]将它从项目中移除。
一个大的工程可能包含许多子文件夹,搜索破损文件会非常花费时间。CodeBlocks提供ThreadSearch插件来解决这个问题。在ThreadSearch中输入要查找的表达式,并设置查找的范围:“Project files”或者“Workspace files”,ThreadSearch将会分析所有包括在项目或者解决方案中的文件。当ThreadSearch找到一个跋损文件的时候,会发出一个文件丢失的错误。
1.11.13 包含库
在项目的编译选项中,你可以通过”Add”按键添加项目所使用的库。库可以以绝对路径的形式给出,也可以只给出名称而无需提供lib前缀和文件扩展名。
例如:存在这样的一个库文件:
1.11.14 对象链接顺序
在编译过程中,源文件name.c/cpp将会被编译成目标文件name.o,然后链接器把独立的目标文件链接成可执行文件name.exe(对于嵌入式系统,将链接成name.elf)。这种情况下,可能需要预先定义对象链接的顺序。在CodeBlocks中,可以设置相关源文件的优先级来实现。在上下文菜单中选择[Properties],在Build标签中定义。较低优先级使文件较先链接。
1.11.15 自动保存
CodeBlcoks允许自动保存当前正在编辑的文件和项目,或者对它们进行备份。可以通过菜单[Settings->Environment->Autosave]来激活该功能。
1.11.16 文件扩展名设置
在CodeBlocks中,可以选择多次方式来处理文件不同后缀的文件,可以在菜单[Settings->Environment settings->Files extension handling]设置相应的处理方式:“Launch an external program”指定外部程序来打开文件;“Launch the associated application”使用系统默认程序来打开文件;“Open it in Code::Blocks editor”使用Code::Blocks编辑器来打开文件。如下图:
2
1
1.12 通过命令行操作CodeBlocks
CodeBlocks能够通过命令行来运行。在这种情况下,需要通过一些选项来控制项目的构建过程。因为CodeBlocks是scriptable的,所以CodeBlocks项目的构建可以集成到你自己的工作过程中。
codeblocks.exe /na /nd --no-splash-screen --built
--file=
/h, --help:显示帮助信息。
/na, --no-check-associations:不执行文件关联检查。(windows only)
/nd, --no-dde:不启动DDE服务。(windows only)
/ni, --no-ipc:不启动IPC服务。(Linux and Mac only)
/ns, --no-splash-screen:应用程序启动的时候,不显示启动画面。
/d, --debug-log:显示应用程序的调试日志
--prefix=
/p, --personality=
2
2
“ask”参数来列出可选择的个性化配置。
--rebuild:清理并重新编译工程或解决方案。
--build:编译工程或解决方案。
--target=
--no-batch-window-close:编译完成的时候,不关闭日志窗口。
--batch-build-notify:编译完成的时候显示提示信息
--safe-mode:启动的时候,所有插件都不可用。
>
1.13 快捷键
在IDE中使用快捷键比使用鼠标更为高效。下表给出CodeBolcks默认的快捷键。(译者注:笔者将CodeBlocks中的快捷键设置为与VS大体一致,使用CodeBlocks时非常顺手。)
Function Shortcut Key Undo last action Ctrl + Z
Redo last action Ctrl + Shift + Z Cut selected text Ctrl + X Copy selected text Ctrl + C
Paste text from clipboard Ctrl + V Select all text Ctrl + A Swap header / source F11
Comment highlighted code Ctrl + Shift + C Uncomment highlighted code Ctrl + Shift + X Duplicate line caret is on Ctrl + D
Auto-complete / Abbreviations Ctrl + Space / Ctrl + J Show call tip Ctrl + Shift + Space
Swap line caret is on with line above it Ctrl + T Toggle bookmark Ctrl + B
Goto previous bookmark Alt + PgUp Goto next bookmark Alt + PgDown Toggle current block folding F12 Toggle all folds Shift + F12
CodeBlocks代码编辑器组件提供的快捷键,这些快捷键不能重新绑定(rebound)。
2
3
Function Shortcut Key
Magnify text size. Ctrl + Keypad \ Reduce text size. Ctrl + Keypad \
Restore text size to normal. Ctrl + Keypad \ Cycle through recent files. Ctrl + Tab Indent block. Tab
Dedent block. Shift + Tab
Delete to start of word. Ctrl + BackSpace Delete to end of word. Ctrl + Delete
Delete to start of line. Ctrl + Shift + BackSpace Delete to end of line. Ctrl + Shift + Delete Go to start of document. Ctrl + Home
Extend selection to start of document. Ctrl + Shift + Home Go to start of display line. Alt + Home
Extend selection to start of display line. Alt + Shift + Home Go to end of document. Ctrl + End
Extend selection to end of document. Ctrl + Shift + End Go to end of display line. Alt + End
Extend selection to end of display line. Alt + Shift + End Expand or contract a fold point. Ctrl + Keypad \ Create or delete a bookmark. Ctrl + F2 Go to next bookmark. F2
Select to next bookmark. Alt + F2 Find selection. Ctrl + F3
Find selection backwards. Ctrl + Shift + F3 Scroll up. Ctrl + Up
Scroll down. Ctrl + Down Line cut. Ctrl + L
Line copy. Ctrl + Shift + T Line delete. Ctrl + Shift + L
Line transpose with previous. Ctrl + T Line duplicate. Ctrl + D
Find matching preprocessor conditional, skipping nested ones. Ctrl + K Select to matching preprocessor conditional. Ctrl + Shift + K
Find matching preprocessor conditional backwards, skipping nested ones. + J
Select to matching preprocessor conditional backwards. Ctrl + Shift + J Previous paragraph. Shift extends selection. Ctrl + [ Next paragraph. Shift extends selection. Ctrl + ] Previous word. Shift extends selection. Ctrl + Left Next word. Shift extends selection. Ctrl + Right Previous word part. Shift extends selection. Ctrl + / Next word part. Shift extends selection. Ctrl + \\
2
Ctrl 4
Files
Function Shortcut Key New file or project Ctrl + N
Open existing file or project Ctrl + O Save current file Ctrl + S Save all files Ctrl + Shift + S
Close current file Ctrl + F4 / Ctrl + W
Close all files Ctrl + Shift + F4 / Ctrl + Shift + W
CodeBlocks的Tab组件所提供的快捷键,这些快捷键不能重新绑定(rebound)。
Function Shortcut Key
Activate next open file Ctrl + Tab
Activate previous open file Ctrl + Shift + Tab
View
Function Shortcut Key
Show / hide Messages pane F2
Show / hide Management pane Shift + F2
Move project up (in Project tree) Ctrl + Shift + Up
Move project down (in Project tree) Ctrl + Shift + Down Activate prior (in Project tree) Alt + F5 Activate next (in Project tree) Alt + F6 Zoom in / out Ctrl + Roll Mouse Wheel Focus editor CTRL + Alt + E
Search
Function Shortcut Key Find Ctrl + F Find next F3
Find previous Shift + F3 Find in files Crtl + Shift + F Replace Ctrl + R
Replace in files Ctrl + Shift + R Goto line Ctrl + G
Goto next changed line Ctrl + F3
Goto previous changed line Ctrl + Shift + F3 Goto file Alt + G
Goto function Ctrl + Alt + G
Goto previous function Ctrl + PgUp
2
5
Goto next function Ctrl + PgDn Goto declaration Ctrl + Shift + . Goto implementation Ctrl + . Open include file Ctrl + Alt + .
Build
Function Shortcut Key Build Ctrl + F9
Compile current file Ctrl + Shift + F9 Run Ctrl + F10 Build and Run F9 Rebuild Ctrl + F11
Debug
Function Shortcut Key Debug F8
Continue debugging Ctrl + F7 Step over a code block F7
Step into a code block Shift + F7
Step out of a code block Ctrl + Shift + F7 Toggle breakpoint F5 Run to cursor F4
Previous error Alt + F1 Next error Alt + F2
本文来自CSDN博客,转载http://blog.csdn.net/JGood/archive/2010/01/25/5252119.aspx 2请标出处6
明:
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库CodeBlocks详细使用手册(免费)(5)在线全文阅读。
相关推荐: