Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » C++11 Again...(The old hacks dont seem to work in 4.5.0-3 (Mars))
C++11 Again... [message #1709914] Thu, 01 October 2015 17:26 Go to next message
Eclipse UserFriend
Hey Guys...

Sorry to ask... but this -std=c++11 bug seems to have existed since 2010.
Google throws up many many many hits, but none of the hacks for the previous versions seem to work for Mars... it seems the settings layout has changed too much?

Perhaps its time to start shipping CDT with C++11 enabled by default?

Anyway, ot the point....
Could anyone please please please point me to the correct setting for enabling c++11 in Mars?

I Import my project from Git, Import via new project wizzard.
Select C++ Executable. ( I've alos tried Makefile roject and autotools project ).

I've managed to get the actual code to compile..
I create the makefile on the command line using autoconf/automake.
Then i run configure, and point eclipse at the generated makefile.

Macause Makefile.am sets -std=c++11, then all compiles fine.

The problem is with code completion and indexing.
std::shared_ptr, and all other c++11 features are dead.

Any ideas?

Thankyou very much.

Chris.

Re: C++11 Again... [message #1710025 is a reply to message #1709914] Fri, 02 October 2015 13:57 Go to previous messageGo to next message
Eclipse UserFriend

I'm having similar issues.

On a Mac and things like "emplace_back" can't be resolved. They were working, and all of a sudden they stopped.

c++11 and c++14 support is kind of important.

Googled suggestions don't seem to have an effect.
Re: C++11 Again... [message #1710049 is a reply to message #1709914] Sat, 03 October 2015 04:28 Go to previous messageGo to next message
Eclipse UserFriend
I'm using autotools for one of my projects and don't have any issues with the indexer. All of my other projects are makefile projects and definitely not managed builds. I use c++11 exclusively. I haven't had any problems (outside of one exception involving std::random) with the indexer.

What do you mean by "all other c++11 features are dead"?
For instance,does for (auto el : somevector), a c++11 feature, not work? It does for me and Eclipse even deduces the type of el. Most of the time, anyway, Smile

It might help if you were more specific.
Re: C++11 Again... [message #1710067 is a reply to message #1709914] Sat, 03 October 2015 11:58 Go to previous messageGo to next message
Eclipse UserFriend
On 10/02/2015 08:54 AM, chris stones wrote:
> Any ideas?
For CDT Managed builds, you can set the C++ version on the Dialect entry
under C/C++ Build->Settings->Tool Settings. Each compiler on this page
has a Dialect entry. You can pick C++11 from this page.

CDT Managed builds are where CDT manages the Makefile. I'm not sure how
to set this for Non CDT managed builds. My guess is that you have to ad
the -std=c++11 to the Command under the C/C++ General->Preprocessor
Includes->Providers page. I would try adding this to the command for
the CDT GCC Built-in Compiler Settings. You then might have to force a
re-index
Re: C++11 Again... [message #1710071 is a reply to message #1710067] Sat, 03 October 2015 13:55 Go to previous messageGo to next message
Eclipse UserFriend
I don't use managed builds at all. It's not clear what gcc does with -c++11 flag but apparently it turns on some preprocessor macros starting with __cpp. These are likely what the indexer needs . I't hard to get a complete list of these. The following are set in the CDT GCC Builtin Compiler Settings in my projects although 1997 and 1987 dates suggest they aren't related to C++11.

index.php/fa/23447/0/

Perhaps the easiest way to get this info into the list is to enable Discovery even though it's marked as deprecated.

A little old but perhaps helpful:
http://www.eclipse.org/community/eclipse_newsletter/2013/october/article4.php

Still it would be better if the OP could outline what he's really seeing instead of making us guess. His post amounts to "I'm having problems. They are centered around C++11. Any ideas?". The short answer is "Yes" the long answer is too long to post.


[Updated on: Sat, 03 October 2015 14:16] by Moderator

Re: C++11 Again... [message #1710304 is a reply to message #1710071] Mon, 05 October 2015 18:26 Go to previous messageGo to next message
Eclipse UserFriend
this one worked for me:
stackoverflow.com/questions/17457069/enabling-c11-in-eclipse-juno-kepler-luna-cdt
Re: C++11 Again... [message #1710312 is a reply to message #1710304] Mon, 05 October 2015 23:05 Go to previous messageGo to next message
Eclipse UserFriend
The stackoverflow post doesn't help with Mars.

Setting the C+11 flag in makefiles can only be done if Eclipse makefile generation is enabled and the setting is then under Project Properties ==> C/C++ Build ==> Settings ==> GCC C++ Compiler ==> Dialect where the Language standard drop down box is used or by placing something in the Other dialect flags. You probably don't want Eclipse generating the makefile when using Autotools which the OP is using,

The providers tab no longer has the options listed in the stackoverflow post or something must be done to enable them. They aren't present in my installation yet I have no problems with C++11 stuff.


EDIT:
Apparently I was looking at the wrong tab.

The command setting can be changed but the setting is in a different dialog.
Preferences ==> C/C++ ==> Build ==> Settings ==> Discovery tab

Here's the command setting in my installation:
${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"

it's possible that ${COMMAND} or ${FLAGS} turns on C++11 but otherwise it doesn't seem necessary. The variables don't appear under the Build Variables page.



[Updated on: Mon, 05 October 2015 23:29] by Moderator

Re: C++11 Again... [message #1710465 is a reply to message #1710067] Tue, 06 October 2015 20:59 Go to previous messageGo to next message
Eclipse UserFriend
On 10/03/2015 10:58 AM, David Wegener wrote:
> On 10/02/2015 08:54 AM, chris stones wrote:
>> Any ideas?
> For CDT Managed builds, you can set the C++ version on the Dialect entry
> under C/C++ Build->Settings->Tool Settings. Each compiler on this page
> has a Dialect entry. You can pick C++11 from this page.
>
> CDT Managed builds are where CDT manages the Makefile. I'm not sure how
> to set this for Non CDT managed builds. My guess is that you have to ad
> the -std=c++11 to the Command under the C/C++ General->Preprocessor
> Includes->Providers page. I would try adding this to the command for
> the CDT GCC Built-in Compiler Settings. You then might have to force a
> re-index
I did a quick test and adding -std=c++11 to the CDT GCC Built-in
Compiler Settings and rebuilding the index appears to recognize C++11
specifics. Add it to the Command to get Compiler Specs text box. Here
is an example:
${COMMAND} -std=c++11 ${FLAGS} -E -P -v -dD "${INPUTS}"

You set this in the Properties dialog for the project. Expand C/C++
General, Select Preprocessor Include Paths, Macros, etc. Select the
Providers tab on the right hand properties pane and select CDT GCC
Built-in Compiler Settings. Select OK.

Back in the Project Explorer, right click on project and select
Index->Rebuild.
Re: C++11 Again... [message #1751035 is a reply to message #1710465] Tue, 03 January 2017 14:40 Go to previous messageGo to next message
Eclipse UserFriend
I'm using NEON.2 and this didn't work!
I still have a semantic error on shared_ptr.
Re: C++11 Again... [message #1751281 is a reply to message #1751035] Fri, 06 January 2017 18:25 Go to previous messageGo to next message
Eclipse UserFriend
I'm using Neon.2 and shared_ptr seems OK.
index.php/fa/28048/0/

I have C++11 dialect selected in the C++ compiler settings and that is also used when discovery is run. You may need to specify it explicitly on the builtin settings command. See the Providers tab of Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. and select the appropriate builtin provider to see the command being used. You can also allocate a console to see what is being returned by the compiler.




Re: C++11 Again... [message #1766132 is a reply to message #1709914] Fri, 16 June 2017 06:02 Go to previous message
Eclipse UserFriend
What worked for me with neon.2 was setting the c++11 flag in CDT GCC
Built-in Compiler Settings and moving CDT GCC Built-in Compiler Settings to the top of the providers list

CDT GCC Built-in Compiler Settings:
${COMMAND} -std=c++11 ${FLAGS} -E -P -v -dD "${INPUTS}"


index.php/fa/29686/0/
Previous Topic:watchpoint unimplemented call
Next Topic:gmake support for CDT
Goto Forum:
  


Current Time: Thu Mar 27 03:54:57 EDT 2025

Powered by FUDForum. Page generated in 0.03658 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top