quot;g++quot; and quot;c++quot; compiler(“g++和“c++编译器)
问题描述
我刚刚在我的 Ubuntu 上发现,有两种不同的 C++ 编译器:/usr/bin/g++ 和 /usr/bin/c++.我对后者不熟悉,但 man c++ 只是跳转到 gcc 的手册页.我想知道它们作为 C++ 编译器有什么区别?
I just found on my Ubuntu, there are two different C++ compilers: /usr/bin/g++ and /usr/bin/c++. I am not familiar with the latter, but man c++ just jumps to the manpage of gcc. I wonder what is their difference as C++ compilers?
推荐答案
这是典型的 Ubuntu 符号链接混乱.
This is typical Ubuntu symlink mayhem.
如果你ls -l/usr/bin/c++,你会发现它实际上是一个符号链接.到:
If you ls -l /usr/bin/c++, you will see it is actually a symbolic link. to:
/etc/alternatives/c++
这又是一个符号链接:
/usr/bin/g++
所以,在 Ubuntu 系统上,c++ 是 g++.链接间接背后的原因是有多个包可以提供 c++ 编译器(例如不同版本的 g++).你会在 Ubuntu 上看到很多.例如,qmake 是指向/etc/alternatives 中文件的链接,它(在我的系统上)是指向/usr/bin/qmake-qt3 的链接.
So, on Ubuntu systems, c++ is g++. The reasoning behind the link indirection is that there are multiple packages that could provide a c++ compiler (such as different versions of g++). You'll see this a lot on Ubuntu. For example, qmake is a link to a file in /etc/alternatives, which is (on my system) a link back to /usr/bin/qmake-qt3.
这篇关于“g++"和“c++"编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“g++"和“c++"编译器
基础教程推荐
- CString 到 char* 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
