ubuntu

Ubuntu中C++版本如何查看

小樊
42
2025-02-22 10:48:21
栏目: 编程语言

在Ubuntu系统中,可以通过以下几种方法来查看C++的版本:

方法一:使用g++命令

  1. 打开终端
  1. 输入命令并查看输出

例如:

g++ (Ubuntu 10.2.0-13ubuntu1) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

方法二:使用cpp命令

  1. 输入命令并查看输出

例如:

cpp (Ubuntu 10.2.0-13ubuntu1) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

方法三:检查标准库头文件

  1. 打开终端

  2. 使用grep命令查找C++标准库头文件

例如:

#include <iostream>
#include <bits/stdc++.h>

方法四:使用ldd命令检查链接库

  1. 输入命令并查看输出

例如:

ldd (Ubuntu GLIBC 2.31-0ubuntu9.9) 2.31
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Linus Torvalds.

通过以上方法,你可以轻松地查看Ubuntu系统中C++的版本信息。

0
看了该问题的人还看了