c编译器ide_安装C ++编译器和IDE

c编译器ide

Computer can’t directly understand the program that we write in C++ language. Compiler converts the program into machine language that is understand by the computer.

计算机无法直接理解我们用C ++语言编写的程序。 编译器将程序转换为计算机可以理解的机器语言。

As we already know C++ is a compiled language. This means that every source file needs to be converted into an intermediate code called the object code with the help of a proper compiler and then linked with the other required object files to make an executable. You can see this below, to know how the source is processed to produce the output.

众所周知,C ++是一种编译语言。 这意味着每个源文件都需要在适当的编译器的帮助下转换为称为目标代码的中间代码,然后与其他必需的目标文件链接以生成可执行文件。 您可以在下面看到此信息,以了解如何处理源以产生输出。

Installing C++ Compiler and IDE

Image Source

图片来源

So, first we need a standard C++ compiler. To prepare source code, you may also need a professional text editor that offers auto complete and many more useful features. Instead of installing two programs separately, we may use an IDE (Integrated Development Environment) such as Dev-C++, Turbo C++, Codeblocks, etc.

因此,首先我们需要一个标准的C ++编译器。 要准备源代码,您可能还需要一个专业的文本编辑器,该编辑器提供自动完成功能以及更多有用的功能。 代替单独安装两个程序,我们可以使用IDE(集成开发环境),例如Dev-C ++,Turbo C ++,代码块等。

安装C ++编译器和IDE (Installing C++ Compiler and IDE)

对于Windows (For Windows)

For windows there are various options like Dev C++, Codeblocks, etc. You can download them from below link and then install.

对于Windows,有各种选项,例如Dev C ++,Codeblocks等。您可以从下面的链接下载它们,然后安装。

https://www.thecrazyprogrammer.com/downloads

https://www.thecrazyprogrammer.com/downloads

对于Linux (For Linux)

If you are using a Linux or UNIX based system, mostly you don’t have to worry about the compiler installation. Linux and UNIX systems have built in C++ compiler called GNU C/C++ compiler.

如果您使用的是基于Linux或UNIX的系统,则大多数情况下您不必担心编译器的安装。 Linux和UNIX系统已内置称为GNU C / C ++编译器的C ++编译器。

You can check the version of the GNU C++ compiler in your terminal using ‘g++ -v’ command. If it is not installed, you can download one from below link.

您可以使用“ g ++ -v”命令在终端中检查GNU C ++编译器的版本。 如果尚未安装,则可以从下面的链接下载一个。

http://gcc.gnu.org/install/

http://gcc.gnu.org/install/

对于Mac (For Mac)

The simplest and best way you can get the compiler for Mac computer is at xcode development tools. Just follow below link.

获得Mac计算机编译器的最简单,最佳方法是使用xcode开发工具。 只需点击以下链接。

https://developer.apple.com/xcode/

https://developer.apple.com/xcode/

如何保存和运行C ++程序? (How to Save and Run C++ Program?)

1. Write your source code in the editor. 2. Save the file using .cpp extension. 3. Then compile the file.

1.在编辑器中编写源代码。 2.使用.cpp扩展名保存文件。 3.然后编译文件。

Compiling the file differs on the compiler you are using. If you prefer to work with Dev C++, simply pressing F9 key does the task of compilation and F10 key runs the program. If it is a Turbo C++ compiler, use alt+F9 to get the source code compiled and ctrl+F9 to run the compiled code. One thing to note here is that if you have installed the turbo C++ compiler using DOS Box, the commands may differ slightly.

编译文件在您使用的编译器上有所不同。 如果您更喜欢使用Dev C ++,只需按F9键即可完成编译任务,而按F10键即可运行该程序。 如果它是Turbo C ++编译器,请使用alt + F9来获取已编译的源代码,并使用ctrl + F9来运行已编译的代码。 这里要注意的一件事是,如果您使用DOS Box安装了turbo C ++编译器,则命令可能会略有不同。

For Linux systems, here is the procedure.

对于Linux系统,这是步骤。

1. Edit the source code with a built in editor like gedit or vi editor. 2. Then save the file with .cpp extension. 3. To compile it, use the below command.

1.使用内置编辑器(例如gedit或vi编辑器)编辑源代码。 2.然后以.cpp扩展名保存文件。 3.要编译它,请使用以下命令。

g++ -o [objectfilename]  [sourcefilename].cpp 

g ++ -o [目标文件名] [源文件名] .cpp

This produces an executable named as given the object file name which can be run using ‘./objectfilename’

这将产生一个给定的可执行文件,命名为给定的目标文件名,可以使用“ ./objectfilename”运行

Eg: g++ -o hello helloworld.cpp ./hello If you are getting any difficulty to download and install C++ compiler then you can ask your queries by commenting below. I will try to solve your problem.

例如: g ++ -o hello helloworld.cpp ./hello 如果您在下载和安装C ++编译器时遇到困难,则可以通过在下面的注释中提出疑问。 我会尽力解决您的问题。

翻译自: https://www.thecrazyprogrammer.com/2015/07/installing-c-compiler-and-ide.html

c编译器ide

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值