How to migrate to C++ 11 in an OpenSource IDE (cod

2020-04-19 06:18发布

问题:

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 6 years ago.

I am using CodeLite 5.1 on Ubuntu QQ. By default, based on what was intalled previously with QQ and other tools, I have the gtCC and gt++ toolchains avialable. I always use gt++, which seems to get along OK with Boost.

Would like to get things running using C++ 11 - what steps do I need to take? Do I need to install C++ 11 libs?

回答1:

Update See below

I tried on Linux1:

First, under build options, create an entry for the relevant compiler switch:

Zoomed:

Demonstration using g++:

  1. Create project

  1. Set build flags (Global Settings)

  1. Build and run

SUCCESS!

Update:

You will likely want to tick the Enable C++11 Standard checkbox under "Code Completion" too:


1 On Ubuntu Quantal, don't use the distro version - it crashes on opening a project. Use

deb http://repos.codelite.org/ubuntu/ quantal universe


回答2:

You need to supply a -std=c++11 (or similar) command to the compiler you are using. Consult the documentation of your compiler of choice.

Unless you current code is subject to breaking changes that were introduced with C++11, your current code will continue to run "as is". Verify that all your test continue to run, and then you are all set to start using the new features that your compiler supports. Since C++11 support is very much in flux, you might have to upgrade your compiler to its lastest version.