You are on page 1of 72

http://www.codeblocks.org/docs/manual_en.

pdf
JGood(http://blog.csdn.net/Jgood )

C++ VisualStudioVS
VisualStudio VC
VS windows os VS
Express Code::Blocks
VisualStudio C/C++ IDE
Code::Blocks

Code::Blocks
Code::Blocks Code::Blocks
Code::Blocks
Code::Block nightly
buildssvn6088
http://forums.codeblocks.org/index.php/topic,11875.0.html
GCC3.4.5

Code::Blocks Version 1.0


CodeBlocks

Anders F. Bjorklund (afb), Biplab Kumar Modak (biplab), Bartomiej wiecki (byo), PaulA.
Jimenez (ceniza), Koa Chong Gee (cyberkoa), Daniel Orb (daniel2000), Lieven de
Cock(killerbot), Yiannis Mandravellos (mandrav), Mispunt (mispunt), Martin Halle
(morten-macy), Jens Lody (jens), Jerome Antoine (dje), Damien Moore (dmoore), Pecan
Heber(pecan), Ricardo Garcia (rickg22), Thomas Denk (thomasdenk), tiwag (tiwag)
Permission is granted to copy, distribute and/or modify this document under the terms
of the GNU Free Documentation License, Version 1.2 or any later version published by
the Free Software Foundation.

1 CodeBlocks

CodeBlocks

(Management) Project Symbols Project


CodeBlocks VS
Symbols VS

main.cpp

main.cpp, person.cpp, person.hpp

CodeSnippets(links to files)
URL View->CodeSnippets

insert overwrite

modified

Read only Open files

list

CodeBlocks

1.1 Project View

CodeBlocks Project C/C++


<name>.cbp [File>Project]
Project[Add files]
Project

CodeBlocks

Sources*.c*.cpp

ASM Sources*.s*.S*.ss*.asm

Headers*.h *.hpp

Resources*.res*.xrc
[Project tree >Edit file types & categories]

*.ld Linkerscript
Linkerscript*.ld

[Project tree>Categorize by file


types]
1.2 Notes for Projects
CodeBlocks

1.3

CodeBlocks

Documents
andSettingsn/<user>/Application Data/codeblocks/UserTemplates
CodeBlocks
CodeBlocks [New->Project->User templates]

1.4 Create Projects from Build Targets


Release Debug

[Project->Properties] Build Targets


Create project from target

1.5 Virtual Targets


DebugRelease
Debug Debug Release
[Project->Properties->Build Targets]

1.6 (Pre- and Postbuild setps)

Code::blocks
PrebuiltPostbuilt

Creating an Intel Hexformat from a nished object


Manipulating objects by objcopy
Generating dump les by objdump
1.7 Adding Scripts in Build Targets
Code::Blocks
Build Target

1.8 Workspace
CodeBlocks [File->Save workspace]
<name>.workspace
(<name>.workspace)

A (library) A
B A B
ACodeBlocks

[Project->Properties]
[Projects dependencies]

1.9

1.10 (Editor and Tools)

1.10.1 (Default Code)

CodeBlocks
C/C++
default code[Settings>Editor>Default Code]

defaulg code[File->New->File] default code

/*************************************************************************
* Project:
* Function:
*************************************************************************
* $Author: mario $
* $Name: $
*************************************************************************
*
* Copyright 2007 by company name

*
************************************************************************/
1.10.2 Abbreviation
[typing][Abbreviation]
Ctrl + JCodeBlocks
VS C# for
Tab for ~_~
[Settings->Editor] Abbreviation

abbreviation (Parametrisation)$NOW

-->
1.10.3 Personalities
CodeBlocks codeblocks
<user>.conf
default.conf
-personality=myuser CodeBlocks myuser.conf
CodeBlocks

--personality=ask
CodeBlocks

1.10.4 Configuration Files

CodeBlocks codeblocks default.conf


<personality>.conf
cb_share_conf CodeBlocks

defual.conf
/Documents and Settings/Default User/Application Data/codeblocksCodeBlocks
application data

usb CodeBlocks
CodeBlocks usb default.conf

CodeBlocks

1.10.5 Navigate and Search


CodeBlocks
Ctrl + B / Alt + PgUp Alt + PgDn

Project [Find
file]

CodeBlocks
1. #include header.hpp
open include file VS Ctrl
+ Shift + G

2. [Swap header/source]
3.
[Find declaration]
[Find implementation]
VS F12

CodeBlocks
[Search->Find][Search > Find in Files]
Alt + G Ctrl + Alt + G /
// * ?
Visual Assist VS

Ctrl + PgUp Ctrl + PgDn


Ctrl + Tag

VS Ctrl + Tag

[Settings->General Settings][Show line numbers]


Ctrl + G
1.10.6 Symbol view
CodeBlocks C/C++

VS

Global functions:

Global typedefs: typedef

Global variables

Preprocessor symbols: #define


pre-processor symbols

1.10.7

CodeBlocks
[Settings->Environment] chm Help Files
F1
1.10.8
[Tools->Configuration Tools>Add] CodeBlocks
CodeBlocks (Built-in)
${PROJECT_DIR} CodeBlocks

CodeBlocks
Notepad++
Dos ~~

1.11 CodeBlocks Tips


CodeBlocks
1.11.1 Tracking of Modifications

CodeBlocks
[Search->Goto next
changed line][Search->Goto previous changed line]
Ctrl + F3 Ctrl + Shift + F3VS

[Settings->Editor->Margins and caret][Use Changebar]

undo/redo (changebars)
[Edit->Clear changes history]

1.11.2
CodeBlocks windows DDEDynamic
Data Exchange TCP

CodeBlocks
[<command>(<parameter>)

Open [Open(D:/Temp/test.txt)] CodeBlocks


CodeBlocks
OpenLine[OpenLine(D:/Temp/test.txt:10)] CodeBlocks
This
command opens a le at a given line number in a CodeBlocksi nstance.
Raise CodeBlocks

1.11.3
Path

CodeBlocks
CodeBlocks
[Settings->Environment] Environment Varibales Create

1.11.4
CodeBlocks //
default.conf Cdoeblocks
--personality=ask

CodeBlocks [View->Layouts->Save
current][View->Layouts->Layout name]
[View->Perspectives]/

1.11.5
CodeBlocks
CodeBlocks

Alt + F5(Active) VS

Alt + F6

F11(name.cpp)(name.h)

1.11.6
Build Log
[Settings->Compiler and Debugger] Other
Settings Compiler logging

Full command line Build Log


HTML Save build log to HTML file when finished
Display build process barCodeBlocks Build Log

1.11.7
CodeBlocks
Ctrl
[Edit->Special commands->Zoom->Reset]
1.11.8

CodeBlcoks
[Settings->Editor->Other Options] Word
warp
1.11.9
CodeBlocks Alt

VS

1.11.10
CodeBlocks
[Settings->Editor->Folding]
depth limit
1.11.11
CodeBlocks include
/CodeBlocks
[Settings->Editors->Code completion]
Ctrl + Space Ctrl + Space


[Settings->Editor->Syntax highlighting]

1.11.12 Find broken files


(project.cbp)
*.cbp
[Remove file from project]

CodeBlocks
ThreadSearch ThreadSearch
Project filesWorkspace filesThreadSearch
ThreadSearch

1.11.13
Add
lib
<path>/libs/lib<name>.a<name>

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 programLaunch the associated
applicationOpen it in Code::Blocks editor
Code::Blocks

1.12 CodeBlocks
CodeBlocks
CodeBlocks scriptable CodeBlocks

codeblocks.exe /na /nd --no-splash-screen --built <name>.cbp --target=Release


<filename> CodeBlock (*.cbp)(*.workspace)
--file=<filename>[:line] CodeBlocks

/h, --help

/na, --no-check-associationswindows only)


/nd, --no-dde DDE (windows only)
/ni, --no-ipc IPC (Linux and Mac only)
/ns, --no-splash-screen
/d, --debug-log
--prefix=<str>
/p, --personality=<str>, --profile=<str>ask

--rebuild
--build
--target=<str>--target=Release
--no-batch-window-close
--batch-build-notify
--safe-mode
> <build log file> DOS/*nix shell
CodeBlocks

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
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.

Ctrl + 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 + /

Files

Function
New file or project

Shortcut Key
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

Goto next function

Ctrl + PgDn

Goto declaration

Ctrl + Shift + .

Goto implementation

Ctrl + .

Open include file

Ctrl + Alt + .

Build
Function
Build

Shortcut Key
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

You might also like