在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
首先,对Ubuntu 14.04 LTS进行源更新,摘自下述链接: http://chenrongya.blog.163.com/blog/static/8747419620143185103297/ 对其源列表进行备份 1 sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
注: lsb_release -a 查看ubuntu版本号 用编辑器gedit进行打开 sources.list 1 sudo gedit /etc/apt/sources.list
打开后,将下列服务器地址复制粘帖在最后,保存并关闭: deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
设置好上述后,对ubuntu 源进行更新: sudo apt-get update 运行下述,即可实现g++工具的安装 sudo apt-get install g++
g++安装完成。 创建一个简单的cpp文件 1、打开终端: Ctrl + Alt + T 2、创建一个main.cpp文件 先创建一个文件夹(例如:CPP)
mkdir CPP
3、在main.cpp文件中输入: 1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 cout<<"hello This is My first CPlusPlus!"<<endl; 6 return 0; 7 } 4、运行main.cpp 文件 1 g++ main.cpp -o test 运行,输出。 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论