C language development environment set up in the windows

C language development environment set up in the windows

Because basically burn Esp8266 code written in C language, so to build a bit of C language development environment, there is time to learn about the C language

A: Installing the compiler

gcc compiler installation files download path:

https://sourceforge.net/projects/mingw-w64/files/latest/download

After the download is complete start the installer, the default installation, pay attention to best modify the installation path

Find mingw32-gcc-g ++ (note to the class attribute to bin), right-click on Mark for Installation.

Then click Apply changes options menu in the upper left corner of the Installation and management will begin to install or update the online component is selected.

Here wait installer.

After the installation is complete, close the package manager, if for some reason the installation failed, exit the program before the program will give prompt, select the option to review changes to re-install.

II: configuration environment variable

Open the Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables.

PATH options found in the list, select and click edit, add at the end

D: \ MinGW \ bin (I installed the drive d)

Note that if the end of the original value of the PATH did not add a semicolon (;), add your own.

Verify that the installation was successful

Open a command prompt (click Start Menu -> Run, enter determine cmd.exe), input

g ++ -v

Test version of g ++, and if similar results obtained with the following results, is not no such file or command prompt that kind of thing, then the installation is successful.

Three: install the C language compiler

C language editor codeblocks download path:

https://nchc.dl.sourceforge.net/project/codeblocks/Binaries/17.12/Windows/codeblocks-17.12mingw-setup.exe

Double-click to download the complete installation, the default installation (note modify the installation path, it is best not installed in c drive)

软件安装到这里,我们就需要注意,这里是选择编译器,如果你没有安装编译器,那么这里的选项都是置灰 的,所以我们安装一下编译器,推荐安装GCC编译器,因为它小,只有12兆,而且跨操作系统。MinCW太大 42兆,当你安装好GCC以后,你就看到置灰的第一个gcc变亮,然后选择第一个GCC编译器,点击OK

进行完第四步骤,我们的C语言环境就安装好了,现在来新建一个工程测试一下,点击file->new project,然后选择console project也就是控制台应用程序,点击go

然后选择我们要编辑的语言,codeblocks支持两种语言,c语言和C++,简单方便的编辑方式,能够更好,更快的让我们学习C语言,这里我们选择c语言,点击next

然后我们给工程文件命名,这里我们给工程命名为test,注意第二个空白处是我们要选择保存项目工程的文件夹,我们在硬盘中找到一个文件夹,选择就可以了,点击next

我们现在打开刚才建立好的test工程,其中有一个工程默认生成的main.c,里边是一个输出hello world的程序,我们点击左上角的绿色三角,也就是RUN按钮,运行一下程序,会弹出来console对话框,黑色的console对话框里显示的就是我们在程序中输出的信息。

四:添加调试工具 gdb.exe

点击界面settings选择Debugger,弹出框前三个打√,点击右框内的Default,在path路径中填入gdb.exe文件所在路径,如(D:\MinGW\bin\gdb.exe) Debugger Type 选择 GDB ,前四个打√,点击OK

 

打开编译完成的main.c ,在return代码左侧单击出现红点(打断点),点击红色小三角或点击上方栏内的Debug选择Start/Continue 下方控制台输出hellow world 则调试器配置成功。

如果上面都配置成功,恭喜C语言开发环境配置成功!!!

 

Guess you like

Origin www.cnblogs.com/Strangers/p/11929239.html