1

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?

Vector
  • 10,879
  • 12
  • 61
  • 101
  • 1
    Which compiler are you using? What's the platform? What's the OS? I mean, come on, provide us basic information, will you - we're not all working on the same system as you. – sehe Apr 23 '13 at 14:35
  • The documentation says it has generic compiler support. So, use a c++11 compatible compiler. – Peter Wood Apr 23 '13 at 14:41
  • Edited to specify platform etc - at work - pressed for time - apologies. – Vector Apr 23 '13 at 14:59
  • 3
    @Mikey It's okay :) In the meantime I discovered CodeLite (never heard of), installed it (twice) and answered your question. Luckily, also on Ubuntu QQ – sehe Apr 23 '13 at 15:02
  • @sehe - codelite rocks. Got sick of using codeblocks, which has gone dead, and discovered it on here from somebody in some question. It's an active project - they just put out a new release a week or two ago. I mess around with QtCreator but I find it cluttered and of course a bit too Qt oriented. codelite is light and clean. I use Qt with codelite - works fine. – Vector Apr 23 '13 at 15:21
  • The question in its original form showed no research effort, no details, didn't describe why you were unable to use C++11, it was very poor. There were 50,000 questions in the close queue; yours fitted in nicely. In its current state I would still vote to close it. You (or anyone) can improve it if you like and it might get re-opened. That would be a nice gesture seeing how you got such a comprehensive answer. – Peter Wood Apr 24 '13 at 09:14
  • @PeterWood - granted, original version was insufficient. But 'didn't describe why you were unable to use C++11'?? C++ 11 does NOT work automatically, by default in codelite or any IDE that I know of. 'WHY I WAS UNABLE TO USE IT' is a ridiculous requirment for a question of his nature IMO - it's something new - asking HOW TO USE SOMETHING NEW is perfectly valid IMO. – Vector Apr 24 '13 at 16:54
  • @Mikey, I typed [codelite c++11](https://www.google.co.uk/search?q=codelite+c%2B%2B11) into google and got an answer immediately. – Peter Wood Apr 24 '13 at 17:40
  • @PeterWood:OK.That means anything available on google is ineligible for S_O question? Rather go where I'm likely to get first hand knowledge from someone with experience and expertise than take my chances with google. I thought that was a reason for this site. I also use google plenty-but generally for things that I know are likely to be 'common knowledge' in that area of development or documented from MS etc. For a niche question on a not too well known openSource IDE, my first resource is this site.If that's not OK, you need to post a rule'no questions allowed unless you google it first'.:-) – Vector Apr 24 '13 at 18:45
  • @Mikey, The down-vote button, if you hover over it, gives a reason for down-voting is "shows no research effort". Minimal research would be to google it. Anyway, I don't wish to argue. We can chat in the lounge if you like. Peace. – Peter Wood Apr 24 '13 at 19:36
  • @PeterWood - 'minimal reseach' is a bit vague, and certainly depends on the abilities of the one asking the question. Regardless, NP. I got my answer. :-) – Vector Apr 24 '13 at 19:59

2 Answers2

11

Update See below

I tried on Linux1:

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

enter image description here

Zoomed:

enter image description here

Demonstration using g++:

  1. Create project

enter image description here

  1. Set build flags (Global Settings)

enter image description here

  1. Build and run

enter image description here

SUCCESS!

Update:

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

enter image description here


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
sehe
  • 374,641
  • 47
  • 450
  • 633
  • 1
    @BenjaminLindley I know. I'm a conflicted human being :) I like to get quality questions. Sometimes I am curious enough to help, in spite of it. – sehe Apr 23 '13 at 15:07
  • 1
    @sehe Or maybe you just really like getting more rep. – Etienne de Martel Apr 23 '13 at 15:07
  • @EtiennedeMartel It's just really interesting that I'd never heard of CodeLite. It seems highly related to Code::Blocks, IYAM – sehe Apr 23 '13 at 15:08
  • Added a hint on _Code Completion_ for C++11 code – sehe Apr 23 '13 at 15:19
  • @sehe - will check it out - if it work you've got the points. I installed codelite 5.1 from the codelite website itself. – Vector Apr 23 '13 at 15:26
  • @sehe - don't I have to download/install the C++ 11 libs from someplace? C++ is not my WORKING language at the moment (hope to make that so soon enough) I just hack around with it - so I'm not quite up to speed. – Vector Apr 23 '13 at 15:38
  • @Mikey It comes with GCC and Clang. GCC 4.6 had -std=c++0x, and GCC 4.7 uses -std=c++11. (I believe even newer versions may default to c++11) – sehe Apr 23 '13 at 16:21
  • @sehe - OK, good deal - I've got it already. As I said, I didn't use any of the repository installs - I took a Debian/Ubuntu package straight from the codelite webesite - have had no problems at all with QQ. – Vector Apr 23 '13 at 16:27
  • @sehe - codelite seems a lot more polished than codeblocks ever was - always got that 'almost but not quite' feeling from codeblocks. codelite I'm finding to be very smooth for the most part (a glitch here and there that once you discover it, it's not a problem) - I am spending some time going through all the menus to get well acquainted - a lot of good plugins installed by default. I sent them $ - I want that project to remain alive. Their forum is pretty good too. – Vector Apr 23 '13 at 16:34
  • Thank you for this. I would only add that the settings menu is reached by right- (context-) clicking the project name in the Workspace tab. Embarrassed to say how much time I wasted searching in the "Settings" menu for 'Global Settings" ;-) It's project-based. Seems to work fine for me on Lubuntu 16.04.4 distro version of CodeLite (Version 9.1.0). – Dell Anderson Mar 17 '17 at 06:30
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.

Community
  • 1
  • 1
TemplateRex
  • 69,038
  • 19
  • 164
  • 304