linux 下怎样用 eclipse 编译 c++

2025-01-04 11:36:08

Eclipse 一般用作Java开发,但也可以用作C/C++开发工具。那么,在 Linux 系统下,怎样安装 eclipse 用来编译 C/C++ 程序呢?

工具/原料

Eclipse IDE for c/c++ 安装包

一、下载 Eclipse IDE for c/c++ 安装包

1、启动 Linux 系统,使用浏览器从 eclipse 官网下载Eclipse IDE for c/c++ 安装包。地址见图。

linux 下怎样用 eclipse 编译 c++

3、在这儿说明一下,使用此安装包,可以免去安装 eclipse 后还需配置 CDT 的烦恼。作为一个 c/c++ 程序开发者,深感比以前方便了不少。

二、安装 Eclipse IDE for c/c++

1、下载完成后,进入 Eclipse 安装包所在目录,在空白处右击鼠标,启动终端。

linux 下怎样用 eclipse 编译 c++

3、下面进入 eclipse 的安装环节,非常简单。总体来说是解压后即可用。首先,登陆 root 帐户,键入命令 tar -zxvf 安装包名,回车,将压缩包解压到当前目录下。

linux 下怎样用 eclipse 编译 c++

三、使用 eclipse

1、如果像我上面那样将 eclipse 文件夹复制到了 opt 目录,在终端键入 /opt/eclispe/eclipse,回车。eclipse 就启动了。

linux 下怎样用 eclipse 编译 c++

3、为工程取一个名字(例如 test),选择“空工程”,其余选项保持默认(下同),点击“下一步”。

linux 下怎样用 eclipse 编译 c++linux 下怎样用 eclipse 编译 c++

6、填写源文件名,切记,一定要加扩展名。

linux 下怎样用 eclipse 编译 c++

8、代码写完后,点击工具栏的小三角按钮即可对代码编译运行,如果弹出提示框问你“代码已经修改,是否保存”,点击“是”。

linux 下怎样用 eclipse 编译 c++
猜你喜欢