Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » C++11 in Eclipse Mars.1(Can't get Unique pointers to work)
C++11 in Eclipse Mars.1 [message #1712737] Tue, 27 October 2015 18:38 Go to next message
Nicholas Warren is currently offline Nicholas WarrenFriend
Messages: 5
Registered: October 2015
Junior Member
I am trying to update my C++ compiler (I think I've said that right) to comprehend C++11 in Eclipse Mars.1. I've searched the issue online, went through the steps I can find, but still the project fails to build. I have attached the simple little example project I'm trying to get to run if that would help. Any direction is much appreciated. I don't have my brain wrapped around C++ development very well, I'm well versed in Python and MATLAB, and prefer Python so far.
Re: C++11 in Eclipse Mars.1 [message #1712778 is a reply to message #1712737] Wed, 28 October 2015 08:33 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
When you post questions here, it's really helpful if you are more specific about your situation. For instance, you never mentioned how the project is structured in Eclipse. Is it a managed project (Eclipse builds the make files)? There are a host of things you could have done and I can only guess what it is you are experiencing let alone what build errors you are seeing.

Anyway, I tried it and it builds just fine. I'm using linux and GCC though and, since this is a C++11 feature, I had to enable the C++11 dialect. The syntax coloring doesn't like std::unique_ptr for some reason and keeps displaying it in red underline and even gets confused about things that follow it (like std::endl). But it's not accompanied with any error flags. Likely a minor bug. If that's all you're seeing you can safely ignore it.

If you are using managed builds and the compiler is GCC, you can enable C++11 in the Project ==> Properties ==> C/C++ Build ==> Settings and selecting the compiler ==> dialect then specify the dialect (C++11 in this case) with the drop down box labelled Language Standard

You have visual studio files in your zip. If you are actually using VS and/or the MS compiler then you should read
this: http://stackoverflow.com/questions/19857263/how-to-activate-c11-standard-in-visual-studio-2010
and this: https://www.eclipse.org/forums/index.php/t/174655/ if you are trying to get Eclipse to build using cl.exe etc.



[Updated on: Wed, 28 October 2015 08:59]

Report message to a moderator

Re: C++11 in Eclipse Mars.1 [message #1712849 is a reply to message #1712778] Wed, 28 October 2015 18:37 Go to previous messageGo to next message
Nicholas Warren is currently offline Nicholas WarrenFriend
Messages: 5
Registered: October 2015
Junior Member
It is indeed a managed project. I am not trying to use Eclipse in lieu of Visual Studio. I had it running at one point as well, with the same behavior about the "std::uniquie_ptr" and "std::endl" lines. I really like the flexibility of Eclipse, so I'd like to stick with it instead of VS. Thanks for your help!
Re: C++11 in Eclipse Mars.1 [message #1712852 is a reply to message #1712849] Wed, 28 October 2015 19:15 Go to previous messageGo to next message
Nicholas Warren is currently offline Nicholas WarrenFriend
Messages: 5
Registered: October 2015
Junior Member
I've actually got all of the warnings gone, and the build is successful. However, when I hit the green/white "play" button, I get this error message in a pop up window:

Error starting process.
Cannot run program "C:\Users\nwarren\workspace\Unique Pointers Example\Debug\Unique Pointers Example.exe": Launching failed
Cannot run program "C:\Users\nwarren\workspace\Unique Pointers Example\Debug\Unique Pointers Example.exe": Launching failed
Cannot run program "C:\Users\nwarren\workspace\Unique Pointers Example\Debug\Unique Pointers Example.exe": Launching failed


Has anybody encountered this before? Any help is greatly appreciated!
Re: C++11 in Eclipse Mars.1 [message #1712854 is a reply to message #1712852] Wed, 28 October 2015 19:41 Go to previous message
Nicholas Warren is currently offline Nicholas WarrenFriend
Messages: 5
Registered: October 2015
Junior Member
I got it running! I changed the dialects, like David Varra instructed, and also added "__GXX_EXPERIMENTAL_CXX0X__" in Properties->C/C++ General->Paths and Symbols->, "# Symbols" tab, click "Add...", and paste"__GXX_EXPERIMENTAL_CXX0X__" into the "Name" text box. Leave the rest blank, click ok, and then apply. I also went into Properties->C/C++ Build->Tool Chain Editor, and clicked "Restore Defaults". Running well now!
Previous Topic:Eclipse CDT Team Shared Index is not imported correctly when a project is imported
Next Topic:ASM in eclipse
Goto Forum:
  


Current Time: Thu Sep 19 19:11:03 GMT 2024

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

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

Back to the top