Ubuntu eclipse 编译 C/C++
通过下面链接下载安装包
复制到虚拟机中,解压
系统版本
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
解压后,可以正常运行,创建helloworld项目,编译,编译报错
fatal error: stdio.h:No such file or directory
修改源
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
apt-get update
apt-get install libc6-dev
helloworld编译通过,可以运行
此时项目文件夹上还有一个红色的叉,看着有些烦,eclipse提示eclipse: Program "g++" not found inPATH
关闭eclipse
apt-get install g++
打开eclipse,项目文件夹上的红色叉消失了
将eclipse固定在左侧收藏栏,以前启动之后右键就有选项,这个版本不行了
编辑文件
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
然后就可以在左下角的“show applications”中找到eclipse图标了
在图标上点击右键,选择“Add to Favorites”