简体   繁体   English

在我的笔记本电脑上检查 C++ 版本

[英]Checking the C++ version on my laptop

I am currently in a CS class where we use C++, and I run Linux on my laptop.我目前在使用 C++ 的 CS 课程中,我在我的笔记本电脑上运行 Linux。 So the problem is that I think I don't have the most up to date version of C++.所以问题是我认为我没有最新版本的 C++。 I've read online for several commands to get the version and this is my result.我已经在线阅读了几个命令来获取版本,这是我的结果。 Also my Linux version is 16.04, and I am compiling in my terminal另外我的 Linux 版本是 16.04,我正在我的终端中编译

tom@TBT-XPS-13-9360:~/Documents/Subjects/CS/OOP$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 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.

I don' know what part of this is my actual version of C++.我不知道这其中的哪一部分是我实际的 C++ 版本。 If my version is not the most up to date, can someone please give me DETAILED instructions on how to do it.如果我的版本不是最新的,有人可以给我详细的操作说明。 Still getting my Linux legs.仍然得到我的 Linux 腿。

C++ version (Or usually called c++ standard) is different than compiler version. C++ 版本(或通常称为 C++ 标准)与编译器版本不同。

g++ is your compiler, and your current version is g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 g++是你的编译器,你当前的版本是g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

You can use different command to compile your program using different C++ version.您可以使用不同的命令来编译使用不同 C++ 版本的程序。

g++ -std=c++11 yourFile .....
g++ -std=c++14 yourFile .....

As mentioned in the comments, this version of compiler may not support c++17 features yet如评论中所述,此版本的编译器可能尚不支持 c++17 功能

在终端中使用此命令(仅适用于 linux)

cpp --version

要获得 C++ 版本,请使用

c++ --version

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM