Linux 如何为 Fedora 安装 g++?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12952913/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I install g++ for Fedora?
提问by saplingPro
How do I install g++
for Fedora Linux? I have been searching the dnf
command to install g++
but didn't find anything.
如何g++
为 Fedora Linux安装?我一直在搜索dnf
要安装的命令,g++
但没有找到任何东西。
How do I install it?
我该如何安装?
I have already installed gcc
我已经安装了 gcc
回答by Hola Soy Edu Feliz Navidad
instead of g++ you have to write gcc-c++
你必须编写 gcc-c++ 而不是 g++
sudo dnf install gcc-c++
回答by Ruu
You should exec:
你应该执行:
dnf install gcc-c++
回答by Colin
try
sudo dnf update
and then
sudo dnf install gcc-c++
尝试
sudo dnf update
然后
sudo dnf install gcc-c++
回答by Siddharth Pant
Since Fedora 22 yum has been deprecated so the commands given in other answers will actually fire up 'Dandified yum' i.e. dnf
. So the new command to install g++ in recent distributions is
由于 Fedora 22 yum 已被弃用,因此其他答案中给出的命令实际上会启动 'Dandified yum' 即dnf
。所以在最近的发行版中安装 g++ 的新命令是
su -c "dnf install gcc-c++"
As of Nov 2015 this installs the 5.1.1 version.
Also note that in Fedora 23 when I gave the command g++ -v
, Fedora automatically asked me if I want to install gcc-c++ package. I think thats nice.(After the install it also ran the command g++ -v
for me)
Only nit pick that I can do about it is that instead of a progress indicator you just get * Downloading packages...
message which you may not like if you are on a slow internet connection.
截至 2015 年 11 月,这将安装 5.1.1 版本。
另请注意,在 Fedora 23 中,当我发出命令时g++ -v
,Fedora 会自动询问我是否要安装 gcc-c++ 包。我认为那很好。(安装后它也g++ -v
为我运行了命令)我
唯一能做的就是它不是进度指示器,你只会收到* Downloading packages...
消息,如果你的互联网连接速度很慢,你可能不喜欢.
回答by Lampo Wei
In the newer distribution you can just type command as blow
在较新的发行版中,您只需键入命令作为打击
su root
dnf update
dnf install gcc-c++
回答by Hypereshu
Just make a sample 'Hello World' Program and try to compile it using "g++ sam.cpp" in terminal, and it will ask you if you wish to download the g++ package. Press y to install.
只需制作一个示例“Hello World”程序并尝试在终端中使用“g++ sam.cpp”编译它,它会询问您是否要下载 g++ 包。按y安装。
回答by Khaibar
I had the same problem. At least I could solve it with this:
我有同样的问题。至少我可以用这个解决它:
sudo yum install gcc gcc-c++
Hope it solves your problem too.
希望它也能解决你的问题。
回答by Subham Debnath
Run the command bellow in a terminal emulator:
在终端模拟器中运行以下命令:
sudo dnf install gcc-c++
Enter password and that's it...
输入密码,就是这样...