Compiling from g++ to C++11

Asked 1 years ago, Updated 1 years ago, 83 views

I want to change my C++03 compiler to C++11 compiler in Ubuntu 12.04 I looked it up and it said to give the option -std=c++0x or -std=gnu++0x There was an error on my computer. I don't know exactly how to use it because I haven't used the option. Help me

#include <array>
#include <iostream>

int main()
{
    std::array<int, 3> arr = {2, 3, 5};
    ...
}

This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.

c++ c++11 g++ flag

2022-09-21 15:55

1 Answers

The options (or flags) that specify the compiler are the same as the normal command line parameters. You can use it without anything special.

To specify a compiler for g++ on a terminal $ g++ -std=c++11 your_file.cpp -o your_program You have to write with.

If this doesn't work, then g++ doesn't have a c++11 compiler Type g++ --version in the command line to see if there is a version of 4.8 If not, install the g++-4.8 package


2022-09-21 15:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.