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. So the problem is that I think I don't have the most up to date version of 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

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++. 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.

Upvotes: 16

Views: 57562

Answers (2)

Akash
Akash

Reputation: 189

Use this command in terminal (for linux only)

cpp --version

Upvotes: 3

James Maa
James Maa

Reputation: 1794

C++ version (Or usually called c++ standard) is different than compiler version.

g++ is your compiler, and your current version is 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.

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

Upvotes: 21

Related Questions