
window7下的c编译器—codeblocks的使用与配置.pdf
12页Window7Window7 下下 Code::BlocksCode::Blocks 的简单使用:的简单使用: 编译器编译器 Code::BlocksCode::Blocks 的简单使用的简单使用 ⅠⅠ. .编译器编译器 Code::BlocksCode::Blocks 的下载和安装:的下载和安装: ① 安装 Code::Blocks 之前,首先得利用链接软件, 连接到网上, 下载并安装 MinGw: (网址: 双击并安装: 单击 NextNext: : 选择第一个(使用预包装的库目录),当然也可选择第二个(下载最新的库目录): ※选择安装的路径(强烈建议:保持默认的路径)※选择安装的路径(强烈建议:保持默认的路径):: ※※建议全部选择,以防某个插件不能使用:建议全部选择,以防某个插件不能使用: 保证电脑连接上网络,直到将所有文件下载并安装完全完为止: 安装完后的 C 盘目录: ② 下载并安装 Code::Blocks: ( 选择“full”安装: 第一次进入界面(如下): ⅡⅡ. .编译器编译器环境环境的配置的配置: : 进入主界面后,主菜单 SettSetting ing - -> > Compiler and debuggerCompiler and debugger 弹出对话框中,左边选中第一项:Global compiler Global compiler settingsetting 右边选中“GNU GCC CompilerGNU GCC Compiler”(通常默认): 其下选中“Toolchain executablesToolchain executables”(第四个选项), 点一下 AutoAuto- -detectdetect,会让 C::B自动检测到 MinGWMinGW 的安装路径(如果你不是安装在默认路径,则点击选择你所安装的路径后点“OKOK”): ⅢⅢ.编辑器的优化:.编辑器的优化: ※※以下需要设置的地方均在以下需要设置的地方均在 SettingsSettings- ->Editor>Editor 弹出的对话框中弹出的对话框中: : 1)优化代码自动完成功能: 选择“CodeCode- -completion and symbol browsercompletion and symbol browser”” ①将 Automatically launch when typed # letterAutomatically launch when typed # letter 中的 4 4 改成 2 2,这样打两个字母就会有提示了。
②将 Keyword sets to additionally includeKeyword sets to additionally include 中 1 1 到 9 9 都勾上 ③将 Delay for autoDelay for auto- -kickkick- -in when typing [.::in when typing [.::- ->]>]拉到 200ms200ms,这样快点出来提示 ④选中 CaseCase- -sensitive matchsensitive match,防止一些无关的东西干扰,如果你想它帮你纠正大小写,那就去掉勾 2)在 AbbreviationAbbreviation 一栏,里面定义了许多缩写(还可以自定义),只要输入这些缩写,并按 Ctrl+JCtrl+J, 就可以自动完成常用的代码框架, 并将光标放在恰当的地方 (自定义时用|表达) 常用的有:guardguard、、classclass、、switchswitch 等 3)打开 Code::BlocksCode::Blocks,选择主菜单“SettingsSettings” -> “Compiler and debuggerCompiler and debugger” ,选择GNU GCC CompilerGNU GCC Compiler (一般默认), 选中 Enable EffectiveEnable Effective- -C++ warningsC++ warnings ((thanks Scott Meyersthanks Scott Meyers)) [ [- -Weffc++],Weffc++],这样配置,能让以后在 Code::Blocks 新建 C++项目,都使用这个选项。
Ⅳ.Ⅳ.编译器的编译器的测试测试:: 打开 Code::BlocksCode::Blocks: : 单击 Create a new project:Create a new project: 选择 Console application::一直单击 next: 展开 SourcesSources((Code::Blocks 默认提供一个测试代码) :: 依次单击和按钮: 编译成功: 原文地址:原文地址: -06/codeblocks.html06/codeblocks.html 更多内容,欢迎访问:更多内容,欢迎访问: 。
