[img]C:\Documents and Settings\Administrator\桌面\devcppEditor1.gif[/img]Dev-C++ Installation
If you are installing Dev-C++ on your own computer, you should make some changes and additions to the default installation. Here are the details. If you are planning on using GCC, then you're pretty much on your own since I prefer using a development system and will not be much help with the GCC command line parameters.
First of all we are using Dev-C++ 5 beta 9.2 (4.9.9.2) from the Bloodshed website. ( http://www.bloodshed.net/ ). Make sure you choose the installation that includes the minGW compiler.
After installing, you will have a dev-cpp folder on your c: drive. The folder names below refer to folders under the dev-cpp folder which by default is in the c: root folder, i.e. c:\. The following needs to be changed.
1) Change the user default directory changed to the location where you plan to put your projects. This is found in Tools/Environment Options/Files & Dirs.
2) Add the following files to the Templates folder (they can be found in this zip archive file, devcFiles.zip).
CS151.template (new)
ConsoleGDI.template (replacement)
BGI.ico (new)
cs151.ico (new)
CS151App_c.txt (new)
ConsoleGDI.txt (replacement)
3) Save libbgi.a & libconio.a from the zip archive to the lib directory.
4) Save winbgim.h, conio.h, and conio2.h from the zip archive to the include directory.
Testing Your Installation
To test whether all this has worked OK you can do the following.
1) To test the conio library, create a new cs151 Application project and then try to compile and run the following program.
#include <stdio.h>
#include <conio2.h>
int main(void)
{
gotoxy(30,10);
textcolor(LIGHTRED);
printf("Hello World\n\n");
getchar();
return 0;
}
If you see a red "Hello World" in the middle of the screen, your conio library is working OK.
2) To test the graphics library, create a new Console GDI project and compile and run the default program. You should see a window with a white circle in the middle.
Running Lecture Programs
In order to run lecture programs, you must bring them into the proper kind of project folder. It is generally not sufficient to merely open the .c file in Dev-C++. All of the lecture programs were created as either a CS151 Application or a Console GDI project.
To run a nongraphics program create a CS151 Application project. Then copy the lecture source file into this project folder. Now remove the default source using the red X button (or use the green minus button). Then add the lecture source file to your project using the green plus button). You should now be able to compile and run the lecture program.
Follow the same procedure for a graphics program, but bring the source code into a Console GDI project.
Configuring the Dev-C++ Editor
In order to make formatting of you programs easier, I think the following changes to the editor are useful. First start up Dev-C++. Then select Tools/Editor Options and check the boxes on the General tab as shown to the right..
On the Display tab make sure Line Numbers is checked.
With these settings you should use the tab key (not the space bar) for indenting. After doing one indent, further lines will be automatically indented when you use the Enter key.
When you type a Backspace, the cursor will move to the previous tab position ready for further input.
When you get to the end of block of code, press Enter and then the '}' and the '}' will be placed one tab back from the current tab position as required by standard C formatting. This make formatting your C code easy.
Dev-C++ Debugging
The Dev-C++ debugger is a little temperamental. The symptom is the compile keeps asking you if you want to include debugging information and you say yes, but it never happens. Somehow Dev-C++ doesn't want to set the right linker switches to include debugging information in your compiled program. The following recipe has been working for me.
Do the following one time only.
Start up Dev-C++.
Change the linker setting Generate debugging information to the value no. To do this select the Tools/Compiler Options menu, then the Linker option on the Settings tab. Select Generate debugging information and change to no if it is set to yes.
Close Dev-C++.
Now everytime you start Dev-C++, that linker mode will be off. It seems that this must changed from no to yes when you want to debug. This is done following the steps below for each program you want to debug.
When you are ready to debug a program you have been working on do the following.
Change Generate debugging information to yes using the Tools/Compiler Options menu.
Set a break point at the beginning of your program.
Click on the debug tab at the bottom and then click the debug button on this tab.
You will get a message saying there is no debug information in the file, and do you want to generate it:. Answer yes. This will close the tabs at the bottom.
Again click on the debug tab and debug button and you should get a console window up and can now continue stepping through your program. At this point you can also add watch variables. This will allow you to see how your variables are changing as you step through your program.

- 大小: 24 KB
分享到:
相关推荐
EGE图形库是一款专为Dev-C++集成开发环境设计的图形界面库,它提供了一种在C++编程中创建图形用户界面(GUI)的方法。这个库的创建旨在简化Dev-C++用户在进行图形编程时的工作流程,使得开发者可以更加专注于程序...
在本项目中,我们将使用C++编程语言,借助DevC++集成开发环境(IDE)来实现这一经典游戏。 **1. DevC++简介** DevC++是由Bloodshed Software开发的一款免费的C++ IDE,它包含了GCC编译器,支持Windows操作系统。Dev...
在描述中,“下载了用DEV C++打开就可以玩”提示我们,这些游戏的源代码是以C++语言编写,并且可能包含了必要的头文件、库和资源文件,可以直接在DEV C++环境中编译运行。这为学习C++编程和游戏开发提供了一个实践...
在Dev-C++中,用户可以查阅这些文档来了解如何使用特定的函数或库,从而更高效地进行编程。例如,对于C++标准库,文档会覆盖I/O流(iostream)、容器(如vector和list)、算法以及字符串操作等重要内容。 C++语言是...
标题 "水下迷宫 游戏 devc++5 SDL编译" 提供的信息表明,这是一个使用Dev-C++ 5集成开发环境(IDE)和Simple DirectMedia Layer (SDL)库开发的水下迷宫主题的游戏项目。SDL是一个跨平台的开源库,主要用于图形、音频...
在C++中,可以使用`sleep_for`函数(需要包含`<chrono>`库)或者旧的`sleep`函数(需要`<unistd.h>`头文件)来实现。 3. **字符输出**:C++中的`std::cout`用于向标准输出设备(通常是显示器)打印字符。通过在不同...
【标题】"用C++在DEV-C++上实现的学生成绩管理系统"涉及的主要知识点包括C++编程语言、面向对象编程、文件操作以及GUI(图形用户界面)设计。以下是对这些知识点的详细说明: 1. **C++编程语言**:C++是一种通用的...
在C语言中,实现代码雨效果通常涉及到图形库的使用,这里提到的“graphics图形库”可能是指Borland的Turbo C++或Dev-C++等集成开发环境中的图形库,如BGI(Borland Graphics Interface)。这些库提供了一系列函数,...
总之,选择合适的IDE是提升编程效率的关键,对于蓝桥杯C/C++项目的参与者来说,理解并熟练使用这些IDE的特性,将有助于他们在比赛中取得更好的成绩。同时,利用提供的资源和文件,按照指导进行配置和实践,是掌握...
Dev C++是由Bloodshed Software开发的一款免费开源的C++集成开发环境,它集成了GCC编译器(GNU Compiler Collection)和一个基于OpenGL的图形库,使得开发者可以方便地进行C++程序的编写和调试。64位版本则针对64位...
在这个项目中,开发者选择了DevC++ EGE图形库来实现游戏的图形界面,这表明我们将深入理解C语言如何与图形库结合,创建出具有用户友好界面的游戏。 1. **C语言基础**: - 变量、数据类型:理解并使用C语言中的基本...
本项目采用C语言编写,利用了Turbo C(简称TC)集成开发环境中的图形库,因此该程序只能在Turbo C环境下运行。 **C语言** C语言是一种广泛应用的高级编程语言,由Dennis Ritchie于1972年在贝尔实验室创造。它的...
在这个过程中,我们将探讨如何使用特定的库,如BGI(Basic Graphics Interface),它是一个用于C语言的图形库,可以帮助我们实现光栅图形学、二维图形以及三维图形的创建。 计算机图形学是计算机科学的一个分支,它...
要在C语言中绘制五星红旗,需要使用一些图形库或图形处理工具,例如SDL(Simple DirectMedia Layer)或OpenCV。这些库可以用来创建窗口、绘制图形和处理图像。在本文中,我将演示如何使用SDL库来绘制五星红旗,并...
---一个完整的DEVC++安装后的文件夹 ---已经成功集成了“Allegro”(最出名的有c/c++的免费的开源的游戏库) ---这样,只要你学完了C语言就可以自己编写...---下载后,只需创建出一个devc++ IDE的快捷方式即可使用。
在这个项目中,开发者使用C语言构建了一个游戏,这通常涉及到游戏逻辑、图形渲染、用户输入处理等多个方面。 【描述】:“c语言大丰收游戏源码.zip” 描述简单明了,表明这是一个压缩文件,格式为.zip,其中包含了...
本项目是基于C语言的一次实践,使用了Ege图形库,为初学者提供了一个很好的学习平台。让我们深入探讨这个"Dev C++飞机小游戏(Ege库)"的各个组成部分,以及如何利用C语言和Ege库来构建这样的游戏。 首先,C语言是...
6. **库支持**:Dev-Cpp支持多种库的集成,如SDL、OpenGL、Boost等,为游戏开发、图形界面设计等提供了便利。 7. **轻量级**:相比于其他大型IDE,Dev-Cpp的体积小、占用资源少,尤其适合配置较低的计算机或需要...
- 使用了标准的C++输入输出库`#include<iostream.h>`,注意这个头文件实际上是C++的旧版本用法,在现代C++中应使用`#include <iostream>`。 - 字符串处理函数来自`#include<string.h>`,用于处理字符串数据。 - 游戏...
6. **用户界面**:在C语言中,通常使用标准输入输出(如`printf`和`scanf`)或者图形库(如SDL或Allegro)来创建简单的用户界面,显示游戏画面。 【学习重点】 - **C语言基础**:理解和掌握C语言的基本语法,如变量...