Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Incorrect FAQ? CDT does not recognize C++11 features
Incorrect FAQ? CDT does not recognize C++11 features [message #908917] Thu, 06 September 2012 08:21 Go to next message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,

The FAQ states:
"- Source navigation and symbol resolving
You should add the option -std=c++0x to the scanner discovery in Project
Properties->C/C++ Build ->discovery Options in the field "compiler
invocation arguments"."

However there is no such path in the CDT version 8.1. What is the
correct solution for this problem in 8.1?

--
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl


Cheers,

Joost
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #909014 is a reply to message #908917] Thu, 06 September 2012 12:22 Go to previous messageGo to next message
Sunil Matta is currently offline Sunil MattaFriend
Messages: 8
Registered: April 2012
Junior Member
I had posted the same earlier under topic of ide unable to recognize certain symbols. I couldnt find anyplace to add options to the compiler. Looked through a bunch of menus.

Although from what I can tell, its not the build itself. That seems to work.
Its the indexing of all the symbols that eclipse uses, which I think is broken out of the box. There has to be a place to specify to the ide that we need c++0x.

My symbols are that I get a bunch of undefined symbol errors in the ide, and content assist and code completion is now broken.

I imagine you are seeing the same. Its back to good old emacs until this gets resolved.
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #909018 is a reply to message #908917] Thu, 06 September 2012 12:32 Go to previous messageGo to next message
Andrew Gvozdev is currently offline Andrew GvozdevFriend
Messages: 257
Registered: July 2009
Senior Member
Project Properties->C/C++ General->Preprocessor Include Paths, Macros->[Providers] tab->your Built-in Compiler Settings provider (toolchain dependent).
Click on "Workspace Settings" link which gets you to "Settings" property page, select [Discovery] tab and your provider again. There is "Command to get compiler specs", add "-std=c++0x" in there.

I suppose there is some room for improvement on CDT side to make it easier.
Andrew
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #909226 is a reply to message #909018] Thu, 06 September 2012 19:00 Go to previous messageGo to next message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 273
Registered: July 2009
Senior Member
On 06-09-12 14:32, Andrew Gvozdev wrote:
> Project Properties->C/C++ General->Preprocessor Include Paths,
> Macros->[Providers] tab->your Built-in Compiler Settings provider
> (toolchain dependent).
> Click on "Workspace Settings" link which gets you to "Settings" property
> page, select [Discovery] tab and your provider again. There is "Command
> to get compiler specs", add "-std=c++0x" in there.
Thanks, although it does solve all problems. The example program from
http://en.cppreference.com/w/cpp/thread/thread/thread gives problems at
the lines 37/38:
std::thread t3(f2, std::ref(n));
std::thread t4(std::move(t3));

>
> I suppose there is some room for improvement on CDT side to make it easier.
Checkboxes for the compiler, like warning levels maybe? . And don't
forget other
things from the standard that requires flaggs, e.g. threads....


--
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl


Cheers,

Joost
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #909228 is a reply to message #909018] Thu, 06 September 2012 19:02 Go to previous messageGo to next message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 273
Registered: July 2009
Senior Member
Oh, and it also still does not find std::shared_ptr ....


--
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl


Cheers,

Joost
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #909739 is a reply to message #909228] Fri, 07 September 2012 17:19 Go to previous messageGo to next message
Sunil Matta is currently offline Sunil MattaFriend
Messages: 8
Registered: April 2012
Junior Member
omg ... that is so unintuitive !!! This is an ide, we need to change the config management.


Anyway, Joost: Rebuild your index. That should solve some of the problems. It did for me. However new problems arose.
Now I cannot find certain stl algorithms (only in the ide). The compiler is able to find them and all other references to compile/link and produce a good executable.
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #909741 is a reply to message #909018] Fri, 07 September 2012 17:21 Go to previous messageGo to next message
Sunil Matta is currently offline Sunil MattaFriend
Messages: 8
Registered: April 2012
Junior Member
Thanks for this Andrewn !
I tried this and *some* of the problems were resolved.
I still get some references that are marked as "undefined" in the ide, even though build is still successful.
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #990423 is a reply to message #909018] Wed, 12 December 2012 12:55 Go to previous messageGo to next message
Chetan Kadam is currently offline Chetan KadamFriend
Messages: 1
Registered: July 2009
Junior Member
Thanks Andrew Gvozdev !!
It worked after refreshing project.
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #1105885 is a reply to message #908917] Tue, 10 September 2013 11:54 Go to previous messageGo to next message
Anders Tangedal Nordeide is currently offline Anders Tangedal NordeideFriend
Messages: 3
Registered: September 2013
Junior Member
So there is no way to set this globally? It seams very counter intuitive that i should have to set such a basic option on every project. Can't I even create some sort of template for it?
Re: Incorrect FAQ? CDT does not recognize C++11 features [message #1112464 is a reply to message #1105885] Thu, 19 September 2013 18:56 Go to previous messageGo to next message
Galen Brownsmith is currently offline Galen BrownsmithFriend
Messages: 3
Registered: August 2013
Junior Member
Quote:
So there is no way to set this globally?



If you followed the directions above, your change will persist for any other project in the same workspace using the same toolchain.
Which is still annoying, but is better than needing to set it per project.

You can export the workspace settings and re-import them for a new project to pass it along. Or you could keep a copy the languages.settings.xml file from $workspace/.metadata.plugins/org.eclipse.cdt.core and merge it into new workspaces.

(To restate the aforementioned instructions in a more step by step/verbose manner:
Open project properties.
Select the 'C/C++ General' subtree, then Preprocessor Include Paths branch.
Select the Providers tab. Then Built-in Compiler Settings provider. (The name of this weill be toolchain dependent. My usual option is "CDT GCC Built-in Compiler Settings" )
In the Language Settings Provider box, select the "Workspace Settings" hyperlink.

In the new settings window, change to the Discovery tab (if you're not already on it, but on Error Parsers).
Again, select the tool-chain dependent Built-in Compiler Settings.

In this window's Language Settings Provider Options window, add "-std=c++11" or -"std=c++0x" (without then quotes) to the command line somewhere before the '"${INPUTS}"' option (and make sure there are spaces on either side of the new parameter). )

(There are simpler ways, IMO, to get to that correct tab, but I'm just copying from above.)

Although, given that the C++11 standard is now over 2 years old (not to mention that first Technical Report was in 2007, and the '11 standard didn't add anything, IIRC), I'm really surprised that it isn't the default by now.

(This isn't to say that I've got indexing working right. std::[foo]_ptr, std::unordered_[map/set] and others are still failing to parse correctly. I'm very close to the point where I'm going to implement thin wrapper classes, just so the indexer issues stop.)

Re: Incorrect FAQ? CDT does not recognize C++11 features [message #1131375 is a reply to message #909018] Thu, 10 October 2013 13:13 Go to previous message
x t is currently offline x tFriend
Messages: 5
Registered: January 2013
Junior Member
Andrew Gvozdev wrote on Thu, 06 September 2012 08:32
Project Properties->C/C++ General->Preprocessor Include Paths, Macros->[Providers] tab->your Built-in Compiler Settings provider (toolchain dependent).
Click on "Workspace Settings" link which gets you to "Settings" property page, select [Discovery] tab and your provider again. There is "Command to get compiler specs", add "-std=c++0x" in there.

I suppose there is some room for improvement on CDT side to make it easier.
Andrew


This is great! Indexer finally fixed
Previous Topic:No Console Output in Eclipse CDT Kepler
Next Topic:Autoconf Library setting soname
Goto Forum:
  


Current Time: Sat Apr 20 04:04:28 GMT 2024

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

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

Back to the top