Ubuntu eclipse 编译 C/C++

  • Ubuntu eclipse 编译 C/C++

  1. 通过下面链接下载安装包

https://ftp.jaist.ac.jp/pub/eclipse/technology/epp/downloads/release/2022-12/R/eclipse-cpp-2022-12-R-linux-gtk-x86_64.tar.gz

  1. 复制到虚拟机中,解压

  1. 系统版本

root@winson:/etc/apt#lsb_release -a

No LSB modules areavailable.

Distributor ID: Ubuntu

Description: Ubuntu 20.04.5 LTS

Release: 20.04

Codename: focal

  1. 解压后,可以正常运行,创建helloworld项目,编译,编译报错

fatal error: stdio.h:No such file or directory

  1. 修改源

vi /etc/apt/sources.list

#阿里源

debhttp://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse

deb-srchttp://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse

debhttp://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universemultiverse

deb-srchttp://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universemultiverse

debhttp://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universemultiverse

deb-srchttp://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universemultiverse

debhttp://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universemultiverse

deb-srchttp://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universemultiverse

debhttp://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universemultiverse

deb-srchttp://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universemultiverse

  1. apt-get update

  1. apt-get install libc6-dev

  1. helloworld编译通过,可以运行

  1. 此时项目文件夹上还有一个红色的叉,看着有些烦,eclipse提示eclipse: Program "g++" not found inPATH

  1. 关闭eclipse

  1. apt-get install g++

  1. 打开eclipse,项目文件夹上的红色叉消失了

  1. 将eclipse固定在左侧收藏栏,以前启动之后右键就有选项,这个版本不行了

  1. 编辑文件

root@winson:/usr/share/applications#cat eclipse.desktop

[Desktop Entry]

Name=Eclipse

Comment=Eclipse

Exec=/opt/eclipse/eclipse

Icon=/opt/eclipse/eclipse48.png

Terminal=false

Type=Application

Categories=Application;

StartupNotify=true

  1. 然后就可以在左下角的“show applications”中找到eclipse图标了

  1. 在图标上点击右键,选择“Add to Favorites”

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值