`
daojin
  • 浏览: 678087 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

在Dev C++中使用c语言图形库的配置

阅读更多
[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
分享到:
评论
3 楼 daojin 2013-12-14  
I thinks this is not a good idear to do Graphic study.
If you want, please study openGL. I at that time do this just because i want to study computer graphics, and i do not know how to use opengl
2 楼 daojin 2013-12-14  
I thinks this is not a good idear to do Graphic study.
If you want, please study openGL. I at that time do this just because i want to study computer graphics.
1 楼 linyeokka 2013-11-04  
I got some problem after following your steps
the error is "[Linker error] undefined reference to `gotoxy'"

I follow your step rigorously

相关推荐

    EGE图形库,只对Dev-c++有用

    EGE图形库,只对Dev-c++有用,下载教程看主页(稍后发)

    Allegro+DEVC++(安装后文件)

    ---一个完整的DEVC++安装后的文件夹 ---已经成功集成了“Allegro”(最出名的有c/c++的免费的开源的游戏库) ---这样,只要你学完了C语言就可以自己编写...---下载后,只需创建出一个devc++ IDE的快捷方式即可使用。

    模拟烟花程序, 用C语言编写.

    模拟烟花程序.由于用了TC的图形库,只能在TC下面跑.

    C语言开发-经典游戏-像素蜘蛛纸牌

    C语言开发--经典游戏--像素蜘蛛纸牌。仅供参考学习。使用DevC++ EGE开发。

    EGG安装和使用说明

    DEV和VC6环境下C语言EGG图形库的安装和使用说明。

    基于c++ ege图形库实现五子棋游戏

    使用面向对象的c++ 和 ege库实现. ege的安装过程不在说明 , 在添加编译链接时去掉 -mwindows 选项. dev c++ 的运行环境设置为 TDM-GCC 4.8.1.32-bit Debug 为保险起见,编译时选择菜单栏里的 运行-全部重新编译(F12)...

    刷题软件(未来教育)和DevC++ 正版安装包(刷题软件可能不是最新版,但特好用)

    未来教育是一个功能强大的智力刷题软件,它拥有国内海量计算机题库,给你提供个性化思维训练,让你学知识,提升自我。 它提供了全面并且丰富的智力题目,包括:侦探推理、逻辑...DevC++也是非常好用的C语言编程软件

    学生选课管理系统.c

    c语言课程设计,学生选课管理系统,编译环境DevC++ 1. 本次课设小组已达到课程目的。主要熟悉C语言中结构体、指针、文件的使用。加深对C语言基础知识的理解和掌握,并规范编程习惯,进一步增强C语言编程实践能力,...

    基于C语言的万年历设计

    3、程序中加入了EGE图形库,因此展示的万年历界面更加的直观; 4、本程序可用于C语言学习者的实践案例吗,也可作为C语言相关的课程设计,但请批评性看待; 5、程序仍有很多的不足之处,有意者可以自行改进。 6、程序...

    C语言我的世界风格推箱子2.0

    免费下载, 是上一版本的改进版,增加了关卡。压缩包含可执行文件和源代码

    touchphone_helper

    编译环境devc++(需要下载)ege图形库(需要自己配置到devc++)adb指令(已提供在tool文件夹下)手机端要打开手机调试主要原理利用adb的input指令,使用c语言演示图基本功能已实现功能:- 1.鼠标左击为触点事件, 支持...

    mingw-get-inst-20111118

    在基本层,MinGW 是一组包含文件和端口库,其功能是允许控制台模式的程序使用微软的标准C运行时间库(MSVCRT.DLL),该库在所有的 NT OS 上有效,在所有的 Windows 95 发行版以上的 Windows OS 有效,使用基本运行...

    RED HAT LINUX 6大全

    12.5 在/etc/passwd文件中使用NISisms 232 12.6 使用网络组 232 12.7 解决问题的一些技巧 233 12.8 小结 233 第13章 网络文件系统 235 13.1 NFS安装 235 13.2 启动和停止NFS守护程序 236 13.3 NFS状态 236 13.4 配置...

    system-monitor-cpp

    CppND系统监控器 面向对象编程课程中系统监控项目的... 如果不使用工作区,请在自己Linux环境中安装ncurses: sudo apt install libncurses5-dev libncursesw5-dev 制作 该项目使用 。 Makefile具有四个目标: buil

    codeblocks安装包

    codeblocks是一个开放源码且功能全面的跨平台C/C++集成开发环境(IDE),采用c++语言开发,使用了蓍名的图形界面库wxWidgets,目前发布了windows版、mac版、linux版。与微软出品的VC++相比,CodeBlocks最大的优势...

    计算机图形学实验报告.doc

    实验环境:DevC++ 实验语言:C语言 2.实验内容 此次实验目的采用了以下算法实现。 2.1.Bresenham画直线算法 根据直线的斜率确定选择X或者Y方向作为计长方向, 在此方向上每次递增一个单位步长(或者一个像素单位), 另...

Global site tag (gtag.js) - Google Analytics