Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Losing C++11 settings in Neon.2(Losing C++11 settings in Neon.2)
Losing C++11 settings in Neon.2 [message #1752445] Mon, 23 January 2017 15:01 Go to next message
Eclipse UserFriend
I have an existing c++ project that I have set up in eclipse that uses c++11. In order for the indexer to work correctly I am setting this
C/C++ General > Preprocessor Include Paths,Marcros, etc > CDT GCC Built-in Compiler setting

to
${COMMAND} ${FLAGS} -E -P -v -dD -std=c++11 "${INPUTS}"

Then I rebuild the index, and it works, but whenever there are big changes, like if I update from svn and there are changes that add or remove files and I refresh the project in eclipse, it starts marking all the c++11 stuff as errors and I go and check the setting and it is back to the original (without the -std=c++11 flag).
I have tried setting it globally as well as project specific, either way it always resets. And when I set it to use the global settings by checking the "Use global provider shared between projects", it is always unchecked again when it resets.
If I am doing local, incremental changes then everything is fine, so I have lived with it so far but as more people are starting to contribute to the code it's getting to be more of a headache.
Re: Losing C++11 settings in Neon.2 [message #1752850 is a reply to message #1752445] Sun, 29 January 2017 04:59 Go to previous messageGo to next message
Eclipse UserFriend
This setting is saved in <Project>/.settings/language.settings.xml. See if this file is in SVN and if the SVN version includes "-std=c++11". My guess is either it is not in SVN or wasn't checked-in after applying the property change. Perhaps it couldn't be modified, because it is read-only. In the latter case, CDT should take care of it as with other project properties.
Re: Losing C++11 settings in Neon.2 [message #1753328 is a reply to message #1752850] Fri, 03 February 2017 17:12 Go to previous messageGo to next message
Eclipse UserFriend
That file, actually the whole .setting folder, is ignored in svn because I don't want it under version control. The folder and file are both RW so that's not the issue.

When I check the language settings file, it accurately reflects what is set in the GUI. The problem is, when I change the setting by adding the -std=c++11 flag, it gets saved to that file, and the eclipse indexer works, but seemingly randomly, at some later time, the indexer will start marking things as errors and when I check that file and the gui settings, they are both reverted back to the default state.

I have that flag set in the global settings(and it seems to stick there) and I have tried setting the project settings to use the global as well as setting it specifically for the project, either way it always reverts back to project-specific without the flag.

I thought that it mainly only happens when big changes happen all at once on the codebase, like an svn update or applying a patch, but it appears to happen more randomly than that.
Re: Losing C++11 settings in Neon.2 [message #1753356 is a reply to message #1753328] Sat, 04 February 2017 09:01 Go to previous messageGo to next message
Eclipse UserFriend
The c++11 option is kept in the .cproject file. Appears this is being overwritten.
Here is the relavant part of the xml for .cproject in my HelloWorld project.
Note the dialect value near the bottom.

index.php/fa/28341/0/

[Updated on: Sat, 04 February 2017 09:06] by Moderator

Re: Losing C++11 settings in Neon.2 [message #1753361 is a reply to message #1753356] Sat, 04 February 2017 12:28 Go to previous messageGo to next message
Eclipse UserFriend
I don't see anything like that in my .cproject file.
The project type I used when creating the project was "Makefile project from existing source" with the GNU autotools toolchain.
I did try making a new c++ project, both empty and hello world, and I couldn't find anything like that in those .cproject files either.

I looked more into the language.settings.xml file. When I add the -std=c++11 flag and then rebuild the index, it rebuilds ok but then the language.settings.xml reverts back. For some reason it is getting overwritten when I rebuild the index.
Re: Losing C++11 settings in Neon.2 [message #1753364 is a reply to message #1753361] Sat, 04 February 2017 14:50 Go to previous messageGo to next message
Eclipse UserFriend
Sorry. I misread your problem. The setting in .cproject is for the makefile creation.

Under .<Project>/.settings/language.settings.xml there is an entry for each build configuration either:
1) If global builtin command: project/configuration/extension/provider-reference
with "id" indicating which provider and "ref" set to "shared-provider"
The id will be something like GCCBuiltinSpecsDetector
2) if local builtin command: project/configuration/extension/provider
with provider info including the command

IIRC, the usual name for the configuration is "Default" for a makefile project and the name of the active configuration is stored in .cproject
If you have more than one build configuration, this could be what is getting reset. Normally, for a makefile project, you wouldn't expect multiple configurations but with some finagling it's possible. One of my makefile projects has two configurations, Default and Debug.

If you have more than one configuration, set them all to use the global provider.





[Updated on: Sun, 05 February 2017 08:30] by Moderator

Re: Losing C++11 settings in Neon.2 [message #1753402 is a reply to message #1753364] Sun, 05 February 2017 23:29 Go to previous messageGo to next message
Eclipse UserFriend
I think I finally figured out how the settings file is getting reset and why it appeared to happen randomly.

I started watching the settings file for changes and doing various tasks to figure out when it changes and eventually I was able to reproduce it every time by building the project from within eclipse. I normally build outside of eclipse on the command line, which doesn't cause any issues, but every once in a while while coding I will accidentally hit ctrl+b and start a build, which would then reset the settings file and after that the indexer would start messing up when indexing new code until I changed the settings back and rebuilt the index.

Now why it resets every time I build from within eclipse I have no idea. It's a makefile project and it's supposed to just run make right? So maybe it's a bug in eclipse.

For now I at least have an easy fix, remove any key bindings for starting a build and just continue building outside of eclipse like I normally do but do you guys think this is a bug in eclipse? Something that I should report? Or do I maybe have something set up wrong?
Re: Losing C++11 settings in Neon.2 [message #1753404 is a reply to message #1753402] Sun, 05 February 2017 23:34 Go to previous messageGo to next message
Eclipse UserFriend
Also, I tried this out on two projects. One of them did in fact have two build configurations. Not sure why since I never intentionally set up any additional configurations. The other only had one build configuration though. Both projects showed the same issue though.
Re: Losing C++11 settings in Neon.2 [message #1753468 is a reply to message #1753404] Mon, 06 February 2017 15:41 Go to previous messageGo to next message
Eclipse UserFriend
The dialog setting is not for Makefile builds. It's for Discovery of builtin values.

I tried setting up a small workspace; set the global builtin command to pwd and the local command to ${COMMAND} -std=c++11 ${FLAGS} -E -P -v -dD "${INPUTS}".
Two of my projects are Makefile project.
One is a managed build with external makefile.
One has nothing to do with c/c++ but I put in a makefile with empty all and clean targers to avoid getting errors when cleaning or making all projects.

To force a re-run of the builtin discovery command, I cleared all builtin values.
I can't duplicate your problem. When I run Build All, it does not modify the language settings file. However, I didn't try many possible permutations.

You could try creating a new workspace and import the projects into it to see if it might not be a problem with some strange workspace setting.

FWIW: I'm using g++ version 6.3.1 (Red Hat 6.3.1-1) and the macro __GXX_EXPERIMENTAL_CXX0X__ is set even when -std=c++11 is missing. Apparently c++11 or c+14 is the default in this version. Perhaps you could use it in a work around for now.

Also: I am using:
CDT 9.2.0
Eclipse Neon.2 4.6.2


Re: Losing C++11 settings in Neon.2 [message #1753472 is a reply to message #1753468] Mon, 06 February 2017 16:06 Go to previous messageGo to next message
Eclipse UserFriend
I am using
g++ 5.4.0 on Ubuntu 16.04 and eclipse 4.6.2(neon.2).

I've tried it many times now and every single time I build the project from within eclipse, the language.settings.xml file gets updated.
I have also noticed that the file also gets updated back to default settings any time the project gets opened, either via closing and re-opening the project from the project explorer or by closing and re-opening eclipse itself.
Just for fun I set the file as read only and this is the error I got when re-opening the project.

index.php/fa/28360/0/

I'm not sure if I have any type of weird settings. I've always built outside of eclipse so I've never intentionally changed any build settings.
I will try setting up a new workspace and new project and see if I can duplicate this behavior.
Re: Losing C++11 settings in Neon.2 [message #1753473 is a reply to message #1753472] Mon, 06 February 2017 16:10 Go to previous messageGo to next message
Eclipse UserFriend
I should mention as well. I have a co-worker that has this same issue. He is not normally an eclipse user so I did help him set up eclipse on the project and shared some settings with him, but it should have been just code style and templates. It is possible some other setting that is causing this could have tagged along as well.
Re: Losing C++11 settings in Neon.2 [message #1753477 is a reply to message #1753473] Mon, 06 February 2017 17:21 Go to previous messageGo to next message
Eclipse UserFriend
I tried setting mine to RO and there was no write attempt.
Wouldn't think it would try unless the provider info has changed and then only if you pressed Apply or OK in the dialog box.
Certainly is odd.


Along with making a new Workspace, you could try importing the project from scratch using just the source, Copy the project to another directory; delete .settings,.project and .cproject then import it.

[Updated on: Mon, 06 February 2017 18:01] by Moderator

Re: Losing C++11 settings in Neon.2 [message #1760984 is a reply to message #1753477] Thu, 04 May 2017 18:16 Go to previous message
Eclipse UserFriend
Nathan Bahr, did you ever figure this out?

I am having a super similar problem, where I need my existing Makefile project to support C++11 but both "Use global provider shared between projects" and -std=c++11 in project-specific Built-in Compiler Settings get reset.

The difference is that I never build in eclipse and the setting gets reset while the indexer is running. I can tell when the settings get reset because the
#if __cplusplus >= 201103L
blocks change from white to greyed out before my eyes.

This did not happen in Luna and but did in Neon (I first noticed the issue in August 2016) and still occurs in Oxygen (Build id: I20170501-2000).

Did you happen to file a bug report already?
Previous Topic:git cloned c++ repository with no eclipse project configuration files
Next Topic:Cannot convert an existing GCC project to LLVM with Clang
Goto Forum:
  


Current Time: Fri Jul 18 23:06:54 EDT 2025

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

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

Back to the top