Vista中快速搭建C++基本编程环境

来源:互联网 发布:粤语发音软件 编辑:程序博客网 时间:2024/05/22 16:46

Windows Vista中快速搭建C++基本编程环境

这种环境对于平时学习或编写小C/C++程序员来说足以。

ž            1步:下载软件     

ž            2步:安装软件

ž            3步:基本配置

ž            4步:调测运行

ž            5步:单步调测

 

1步:挑选软件,这里选最常用免费编程工具DEVCPP4.9.9.2)(can be downloaded from www.bloodshed.net)

 

2步:安装提示一步步完成安装

 

3步:基本配置

程序安装完成后,安装程序会自己启动配置程序。

注:是否选择XP Theme风格(因为我使用的是Vista,所以,我没有选取,但后期可以再更改)。

 

4步:编程调测

 

Editing one simple program like ‘hello.c’ and Compiling it, one error happened with message ‘studio.h No such file or directory’.

 

#include <studio.h>

int main(void)
{
  int i;
  for( i=1; i <= 10; ++i)
  {
    printf("Hello!");
  }
 
  getchar();
  return 0;
}

Why there happened this error? When I found that ‘studio.h’ can’t be found on my local computer at all, while there are ‘io.h’ and ‘stdio.h’ files, then I came true I included the wrong Head file. Once rectified it by 'stdio.h', ‘hello.c’ was complied to create 'hello.exe'.

It’s obvious that you need to know what files have been installed on your computer under DEVCPP path:

ž            /bin 可执行程序(壳)

ž            /include 头文件 (c++ Head files have been placed under sub-path ‘/c++/3.4.2/’)

ž            /usr (真实的)可执行程序

ž            /lib

If you couldn’t make sure weather the Head files you have included are right or not or what Head files you should include, you can check it under ‘lib’ path directly.

 

5步:单步调测

单步调测对于程序员诊断问题,完成代码非常重要。

Firstly, we should enable ‘Generate debugging information’ in Tools -> Complier Options -> Settings -> Linker menu.

 

Then you can get into Debug process activated by clicking F8, and clicking F7 step by step ensures we could test every change or affection along with each line of our code.

原创粉丝点击