在Ubuntu系统中,可以通过以下几种方法来查看C++的版本:
g++
命令Ctrl + Alt + T
打开。g++ --version
并按回车。例如:
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
命令cpp --version
并按回车。例如:
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.
打开终端。
使用grep
命令查找C++标准库头文件:
grep '#include <iostream>' /usr/include/c++/$(g++ -dumpmachine)/iostream
并按回车。例如:
#include <iostream>
#include <bits/stdc++.h>
ldd
命令检查链接库ldd --version
并按回车。例如:
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++的版本信息。