Integrate all the patches mentioned in this post, unofficial, dual-compiler (vc9, mingw4.4.3) Green Edition, unzip password: csdn
>Http://portablecb.googlecode.com/files/LoveDEV.7z
<Because vc9 is integrated, please delete it within 24 hours after trial!
Official announcement: http://forums.codeblocks.org/index.php/topic,12156.0.html
This period of time is very busy, mainly learning code: BlocksCodeAnd submit a patch for it.
I have submitted several patches for CB over the past few days. You are welcome to test them actively. Thank you very much!
--------------------------------------------------
Http://blog.csdn.net/sdfgh2046/article/details/5812663
Enjoy code: several key aspects of blocks's editing pleasure
Address: http://blog.csdn.net/Utensil/archive/2008/12/24/3593502.aspx
Thanks to loaden. This article is for post http://wxforum.shadonet.com/viewtopic.php? T = 22128 of the summary and sorting, according to personal preferences made trade-offs and re-sorting.
Note:
1) The following items must be set in the dialog box that appears in Settings> editor.
2) Many Commands can target the current line or selected code block.
= Daily editing =
• Press ctrl to roll the wheel, and the font of the Code will become smaller as you wish, which is especially good for protecting your eyesight.
• Right-click the editing area and drag the code to save the trouble of pulling (especially horizontal) the scroll bar. Settings: Mouse drag scrolling.
• Ctrl + D: copy the current row or selected block.
• Ctrl + Shift + C comment out the current row or selected block, and CTRL + Shift + x uncomment.
• Tab indent the current row or selected block, Shift + TAB reduce indentation.
• You can drag a selected block to move it to a new position, and press Ctrl to copy it to a new position.
• Press ATL and then drag the mouse to partially select (that is, only the characters in a region are selected, and no other characters in their row are included ).
• For a larger editing space, F2 and SHIFT + F2 can hide the logs & Others column and the management column on the left, respectively.
= Automatic completion and abbreviation =
1) Optimize the code autocompletion function: In code-completion and symbol browser,
• Change 4 in automatically launch when typed # letter to 2, so that two letters are displayed.
• Hook 1 to 9 in keyword sets to additionally include (the keywords in syntax highlighting... where 1 is the c ++ keyword and 3 is the doxygen keyword. I once added the wxWidgets class name to 7 and set the corresponding font (), especially nice to read code)
• Pull delay for auto-kick-in when typing [.:->] to 200 ms so that a prompt is displayed.
• Select case-sensitive match to prevent irrelevant interference. If you want it to correct the case, remove the check box.
• In keyboard short-cuts, change the shortcut key for edit-> code complete from Ctrl + space to Alt +/, because the former conflicts with the Chinese Input Method switch, the shortcut key is automatically completed for the words that have been entered (not being entered.
2) Check the abbreviation column, which defines many abbreviations (which can also be customized). As long as you enter these abbreviations and press Ctrl + J, you can automatically complete common code frameworks, place the cursor in the appropriate place (use | for custom expressions ). Commonly used include guard, class, and switch.
3) If you declare a class, you can right-click in the CPP file, insert-> all class methods without implementation... you can also use insert-> class method declaration/implementation... to insert a declaration or definition of a method.
= Navigation related =
• Ctrl + G arrives at the specified row, ALT + G arrives at the specified file, CTRL + ALT + G arrives at the specified function (function definition in the header file is supported), and F11 switches the source file and header file.
• Ctrl + Pageup arrives at the previous function, and CTRL + Pagedown arrives at the next function.
• Ctrl + B add bookmarks. Alt + Pageup and ALT + Pagedown can be used to switch between bookmarks.
• Ctrl + Shift + B to find matching parentheses.
• When looking at the long code, you can right-click and select folding-> fold all. Then, you can take full advantage of the symbol browser in the management column on the left.
• Right-click a variable, function, or macro, and select three menu items starting with "find, you can go to its declaration, definition, and find all the places where it appears (Press f2 to view it at the thread search below ).
Others:
• Details such as indentation and line feed can be set in general settings.
• Make code: blocks always remember your layout, especially the debug layout, and make good use of the debug toolbar.
• Back up C:/Documents and Settings/[your user name]/Application Data/codeblocks/default.conf. In case of Reinstallation, place it in the directory where codeblocks.exe will not lose your configuration. In this way, you can also create code :: the green version of blocks.
Think of Scott Meyers, one of the world's top C ++ development authorities) compared with a compiler that has read these two books, compiler C ++ and more powerful C ++.
This is all nonsense.
Open code: blocks (using the Chinese Language Pack Interface), choose "Settings"> "compiler and Debugger" from the main menu, and select the GCC compiler. Then configure its compiler options:
Enable valid tive-C ++ warnings ....
This configuration allows all subsequent C ++ projects created in code: blocks using the GCC compiler to use this option. If you only want to use it in a specific project, you can configure it in a specific project (after opening the project, Main Menu: Project-> build option ).
What are the benefits of this option? Let's test ourselves first:
Code:
-
- # Include <iostream>
-
-
- Using namespace STD;
-
-
- Class person
-
- {
-
- Public:
- Virtual void say ()
-
- {
-
- Cout <"I am a person." <Endl;
-
- }
-
-
- ~ Person ()
-
- {
-
- Cout <"bye-bye person." <Endl;
-
- }
-
- };
-
- Class beauty: Public Person
-
- {
-
- Public:
-
- Beauty ()
-
- : _ P (New INT)
-
- {
-
-
- }
-
-
- ~ Beauty ()
-
- {
-
- Delete _ P;
-
- }
-
- Virtual void say ()
-
- {
-
- Cout <"I am a beauty." <Endl;
-
- }
-
-
-
- PRIVATE:
-
- Int * _ P;
-
- };
-
-
- Int main ()
-
- {
- Return 0;
-
- }
What are the design risks of the above Code? The syntax is certainly no problem. A compiler that has not read books will certainly compile the above code in an obedient manner.
But a compiler that has read a book will give the following warning with simple translation:
| === Temp4book, debug === |
Main. cpp | 7 | warning: 'class person 'has virtual functions and accessible non-virtual destructor
(Row 3, class person has a virtual function, but its destructor are not virtual! Terrible design error)
Main. cpp | 21 | warning: 'class beauty' has pointer data members
(Row 3, class beauty has a pointer data member, next line ......)
Main. cpp | 21 | warning: but does not override 'beauty (const beauty &)'
(However, you have not customized the copy constructor for beauty !)
Main. cpp | 21 | warning: Or 'operator = (const beauty &)'
(Similarly, it does not overload its value assignment operator !)
Main. cpp | 21 | warning: 'class beauty' has virtual functions and accessible non-virtual destructor
(Row 3, class beauty also has a virtual function, but its destructor are not virtual! The reason lies in its base class .)
| |=== Built: 0 errors, 5 warnings ===|
Do you not believe the importance of these warnings? You can buy the two books mentioned above, which are published in China. Here is a simple example:
Code:
- Void test ()
- {
- Beauty B1;
- Beauty b2 = b1;
- }
A serious problem has occurred. Do you know where the problem is? Let's test a question: http://student.csdn.net/space.php? Do = Question & AC = detail> qid = 1839
When codeblocks was used for the first time, it encountered a problem with Chinese characters. The following code indicates that an error occurred during compilation:
Wxstring MSG (_ T ("People's Republic of China "));
Error: Converting to execution Character Set: Illegal byte sequence
During GCC compilation, Chinese characters cannot be correctly converted. The solution is to explicitly tell the GCC compiler that the input file is in Chinese, set the compiler parameters becauseProgramIs very common, so I will set global parameters as follows: settings-> compiler and debugger, for example:
Set compilation options:-finput-charset = GBK
Code: blocks the latest plug-in tool cppcheck. This is a tool for static check of C ++ program code. Like C: B, it is an open-source software.
The home page of SourceForge is: sourceforge.net/#/mediawiki/cppcheck/index.php.
Cppcheck is an analysis tool for C/C ++ code. unlike C/C ++ compilers and other analysis tools, we don't detect syntax errors. cppcheck only detects the types of bugs that the compilers normally fail to detect. the goal is no false positives.
Cppcheck is actually an independent tool that can run completely without any IDE. I used it independently earlier, but I integrated it with C: B, it is much easier to use.
You can find the cppcheck plug-in the new version of the plug-in menu, but you may need to download it separately beforehand and install cppcheck. :
Sourceforge.net/projects/cppcheck/
Download and install cppcheck: (for windows, no experiments have been conducted)
Http://sourceforge.net/projects/cppcheck/files/
Root Installation
Make & make install
For demonstration, get started directly. Make some low-level errors and let cppcheck check:
Code:
-
- # Include <iostream>
-
- # Include <fstream>
-
-
- Using namespace STD;
-
-
- Int main ()
-
- {
- # Define max_int_item_count 100
-
-
- Int * P = new int [max_int_item_count]; // memory allocated
-
-
- For (INT I = 0; I <max_int_item_count; ++ I)
-
- {
-
- P [I] = MAX_INT_ITEM_COUNT-i;
-
- }
-
-
- Return 0; // if no P is released, it will be Byebye.
- }
Run the plug-in. The Code: blocks message bar displays the check result:
In the first row of Main. cpp, there is a possibility of "Memory leakage. The related object is P ."
Continue to change the code:
Code:
- //... the previous code is omitted
- int * P = new int [max_int_item_count]; // memory allocated
-
- for (INT I = 0; I
- {
- P [I] = MAX_INT_ITEM_COUNT-i;
- }
-
- Delete P; // The correct statement should be: Delete [] P;
-
- return 0;
- //...
Run the cppcheck plug-in from the C: B menu ...... This is:
Main. cpp | 17 | mismatchallocdealloc: Error: mismatching allocation and deallocation: p |
In Main. in the CPP file, there is an error "Mismatched memory allocation and release" in row 17th (row 09 in the code snippet), and the object is still: P. (Delete [] is used for release of new []. You must use Delete. That's because you are using a super problematic compiler ....)
Note:
A) Obviously, it cannot check everything.
B) but interestingly, it often finds that you cannot think of the problem yourself. (Occasionally, you get a cold sweat, and you are afraid to write code and stare at the beauty of the side for 120 consecutive minutes)
C) Of course, some of them have been checked out, but it is not necessarily a day. After all, the C ++ program is free, c ++ programmers will all write dark and cool code.
Combined with code: Blocks
A large project or project has a large file (usually generated by a tool). It is slow to check. At this time, C: B will first die and wait slowly, it will become a dead-end.
Install and configure codeblocks 10.05 in Windows
1. Download the installation package
If you have a previous version, you do not need to uninstall it.
Windows Installation download page: http://www.codeblocks.org/downloads/26
Download the link shown in the figure:
Note for advanced users: this link comes with the new version of mingw GCC compiling environment, but it is not the official version (mingw), but the tdm gcc 4.4.1 version. If you want to make another arrangement, for example, you only want to use the VC compiler, you can download another link.
Ii. installation is required!
1) Select custom installation! Custom
2) Select All plug-ins
Otherwise, the plug-in similar to cppcheck will not be found...
3) If you do not check it, you may regret it: Modify the installation target path.
This is not the code: blocks error, but the mingw GCC linker ln.exe has a bug that cannot be linked to a file in a path with spaces or Chinese characters.
Bytes -------------------------------------------------------------------------------------
The remaining steps are similar to General software installation.
3. Configure the compiling environment
1) run code: blocks. The first run will pop up the select compiler. Select the GCC compiler (usually the first ).
2) after entering the main interface, the main menu setting-> compiler and debugger...
In the pop-up dialog box, select the first item on the left: Global compiler setting .. at the top right of the box, select "GNU gcc compiler" (which is usually used by default)
Select "toolchain executables" and click auto-detect to enable C: B to automatically detect the mingw installation path (this is usually correct without checking, for example, if mingw is installed according to the above steps, it is in the installation path of code: blocks ).
Enter the bin sub-directory under the installation path of mingw, for example: C:/codeblocks/mingw/bin. Find out whether there is a mirror mingw32-make.exefolder, if not, find make.exe, copy a copy, rename the copy as mingw32-make.exe.
(In the same way, find out if there is a mingw32-gcc.exe, ming32-gw.w.w.x.exetwo programs, if there is no, do not copy gcc.exe and gw.w.mongo.exe, rename the replica mingw32-gcc.exe and mingw32-gw.w.w.mongo.exe. I forgot whether it exists or not. Check the answer and leave a message)
3) In the same dialog box, switch to the last "Debugger setting" item on the left"
At the top right of "Debugger intialization commands", enter handle sigtrap noprint
This is good for debugging some windows SDK libraries with debugging information. Otherwise, the debugger will constantly stop on the assembly code of some libraries in the operating system ....
On the same page, multiple selection boxes under the editing box can be selected as appropriate except for the last option which is obviously unavailable. (If you can understand the text or cannot understand it, you can install the Chinese Language Pack and check it again ).
Iv. Test
Click the main menu: New-> Project (or click "Create a new project" on the start here page "). Select "project" on the left of the dialog box, and find "console application" in a bunch of icons on the right ". Click Go to start the wizard.
The first step of the Wizard is the welcome page. Go to the next step and select "C ++ ".
On the next page, enter hellocb under the project title without spaces. Folder to create project in:, click the small button at the end to select the parent path of the project you want to store. Do not include spaces. For example, create a directory c:/mycppcode.
In the next step, you do not need to modify it. Generally, the GNU gcc compiler is selected, and two Build targets, debug and release, are selected by default, as shown in. One is used for debugging, one is used for publishing.
Click Finish ...... Open the "Main. cpp" file in the project tree. If you cannot see the project tree, press SHIFT + F2.
This is the default code in Main. cpp:
Code:
- # Include <iostream>
- Using namespace STD;
- Int main ()
- {
- Cout <"Hello world! "<Endl;
- Return 0;
- }
That's right. It's the famous Hello world! Test routine. Press Ctrl + F9 to compile. If everything is set correctly, the compilation should be successful. To view the compilation information, press f2 to make sure the log panel appears. After compilation is successful, press F9 to run ......
Download and use the latest Chinese Language Pack I have prepared, and how to make better configurations. Next, let's talk about it.
5. Important supplements
Windows Vista, Windows 7 users must read:
1), You 'd better install it as the administrator user and use code: blocks.
2) If you want to write and Debug programs such as NT Service, it is best to set the compatibility of codeblocks.exe to "run as administrator. Of course, after this setting, the UAC dialog box will be created every time codeblocks is run in win 7 and other systems.
For Linux and Mac users, the preceding download page already provides Linux Download Links for multiple released versions. Please go to the official website to download them.
For more information, see C: B. Multiple compilers are supported. If necessary, configure the compiler by yourself. If you are interested in self-compiling the New Version C: B, you can download the source code, and then use the previous version 8.02 plus every night to build the upgrade package, from the old C :: B To compile a new version C: B.
Code: blocks provides many engineering templates, including: console Application, DirectX application, dynamic Connection Library, fltk application, glfw application, irrlicht project, ogre application, OpenGL application, QT application, sdcc application, SDL application, smartwin application, static library, win32 GUI application, wxWidgets application, wxsmith project, it also supports custom engineering templates. In the wxWidgets application, select Unicode to support Chinese characters.
Code: blocks supports syntax color conspicuous display and supports Code Completion (currently being re-designed). It supports project management, project construction, and debugging.
Code: blocks supports plug-ins. The current plug-ins include the Code formatting tool astyle; Code Analyzer; Class Wizard; Code completion; Code statistics; compiler selection; copy the string to the clipboard; debugger; file Extension processor; Dev-C ++ devpak Updater/installer; dragscroll, source code exporter, help plug-in, keyboard shortcut configuration, plug-in Wizard; to-do list; wxsmith ;; wxsmith mime plug-in; wssmith Project Wizard plug-in; Windows XP appearance.
Code: blocks has flexible and powerful configuration functions. In addition to supporting its own job files and C/C ++ files, it also supports angelscript, batch processing, CSS files, d language files, diff/patch files, fortan77 files, gamemonkey script files, Hitachi assembly files, Lua files, MASM assembly files, mathlab files, NSIs open-source installer file, ogre compositor script file, ogre material script file, OpenGL shading language file, Python file, Windows resource file, xbase file, XML file, nvidia cg file. Identify Dev-C ++ projects, ms vs 6.0-7.0 project files, workspace files, and solution files.
Codeblocks plug-in Introduction
As we all know, one of the advantages of CB is that the open architecture provides flexible plug-in development and support. We also believe that in the future development, the contribution of plug-ins to CB will become larger and larger.
The following is an overview of the existing core plug-ins and contribution plug-ins:
Core plugins core plug-ins (automatically loaded during system initialization, maintained by the CB Official Development Team)
The core plugins are installed by default and offer the basic functions of code: blocks. The core plugins are maintained/developed by the official development team.
Autosave
-
Saves project files between intervals.
Class Wizard
-
Provides wizard for creating new classes.
Code Completion [this plug-in is very important and is currently in the rewriting stage. It is estimated that we will meet you soon]
-
Provides Code Completion functionality and class browser.
Compiler [provides a unified interface for a large number of compilers]
-
Provides support for varous compilers in one interface.
Debugger
-
Provides support for various debuggers in one interface.
File Extensions Handler
-
Adds extra file extension handlers.
Open files list
-
Manages a list Of all opened files (editors ).
Projects importer
-
Imports projects from other ide's, e.g. MS Visual Studio and devc ++.
Scripted wizard
-
Provides scripted wizard functionality.
Source code formatter [automatically beautify the code style based on different code styles]
-
Formats source code files with specific style.
To-do list
-
Adds to-do items to source code.
WINXP Look 'n' feel
-
Creates manifest file which enables the version 6.0 of the common controls on Windows XP.
Contrib plugins []
The user-ContribUted plugins are not installed by default and offer extended functionality for code: blocks. The contrib plugins are maintained/developed by third-party developers.
Auto Versioning
-
Helps you keep track of your project version and status.
Browse Tracker
-
Browse to previous source positions.
C: B games
-
Games in a integrated development environment? You bet.
Code profiler
-
Provides graphical interface to gnu gprof profiler.
Code snippets
-
Manages small pieces of code (I. e. snippets ).
Code statistics
-
Shows various statistics from source code files.
Copy strings to clipboard
-
Copies literal strings from the current editor to clipboard.
Devpak Installer
-
Installand updates devc ++ devpaks.
Dragscroll
-
Enables dragging and scrolling with mouse.
Environment Variables
-
Sets environment variables within the focus of code: blocks.
Help plugin
-
Integrates third-party help files to the interface.
Hexeditor plugin
-
Opens files in a code: blocks integrated hexeditor.
Keyboard shortcuts
-
Manages menu shortcuts.
Koders [quick search related code on the koder website]
-
Queries the koders webpage for keywords.
Keymacs plugin
-
Keymacs (or keyboard macros) plugin enables recording, playback, and editing of keystroke macros.
RegEx Testbed
-
Regular Expressions testbed.
Source Exporter
-
Exports source code files to other formats such as HTML and PDF.
Symbol table
-
A simple graphical interface to the GNU symbol table displayer (nm ).
Threadsearch
-
Multi-threaded 'search in files' with preview window.
Valgrind
-
Valgrind analysis tools integration.
Wxsmith [quick development of wxWidgets interface program]
-
Rad tool for creating wxWidgets dialogs.
Retrieved from "http://wiki.codeblocks.org/index.php? Title = Code: blocks_plugins"
- CB introduction and features
- code: blocks IDE in opensuse 11.1 compilation and Installation Guide
- codelite plugin internal (1)-iplugin interface
- code: implementation principle of plugin blocks
- Configure the code: blocks help plug-in Linux
- C: command line parameters of B ide
- CB ide internal structure-engineering document
- code: blocks ide: manual compiler installation and configuration guide
- code: blocks to compile Skyeye