Reputation: 69988
Facing variety of issues with the latest Eclipse Juno in Ubuntu 12.04, after switching from Indigo.
I have set below flags in:
Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> Cross G++ compiler
-std=c++11
__GXX_EXPERIMENTAL_CXX0X__
(also set in C/C++ General -> Paths and Symbols)Presently, I am compiling the code which was compiling fine with C++03 in Indigo. After changing to C++11, I did get some errors which were probably due to g++ extension, and I have fixed them.
Now here are the problems which I want to fix:
This file requires compiler and library support for the \ ISO C++
2011 standard. This support is currently experimental, and must be \
enabled with the -std=c++11 or -std=gnu++11 compiler options.
from
the file c++0x_warning.h
. The error doesn't go away even with
clean build or restarting the eclipse.<unrodered_map>
works fine, but if
std::unordered_map<>
is used then it starts giving error. For now,
I am least concerned with this issue among others.If anyone can suggest a link or method to do the effective debugging with Eclipse (Juno), then it will be of great help for future visitors as well.
Note: I have referred several threads in SO, but none of them were helpful:
Eclipse CDT C++11/C++0x support
Cannot set Eclipse Juno C++ with std=c++11
Eclipse CDT Juno - Toolchain issue
Upvotes: 1
Views: 2219
Reputation: 82470
First of all, I started off with a fresh installation of the whole thing, and as something for future reference, I want to show how to install and use GCC with Eclipse from scratch.
Firstly go to the Ubuntu Software Center, and download the latest versions of GCC, which is GCC 4.8. Now, you might encounter problems doing this, so I suggest that you type in gcc-4.8
when trying to find the software. Same thing with g++, you type in g++4.8
to get what you want. Make sure you have the right versions. Due to the open source nature of Linux, there tend to be lots of problems involving versions.
-> : press enter
Now, open up your terminal, and enter the following:
sudo su -
-> this will give you special root privileges.cd /usr/bin
->ls -l gcc* g++* cpp*
->ln -s g++-4.8 g++
->rm cpp gcc
->ln -s gcc-4.8 gcc
->ln -s cpp-4.8 cpp
->Now, open up eclipse. Go to Preferences>New CDT Wizard(or something like that)
Make sure that Linux GCC is selected. Make press the
Make Toochains preferred
.
Now, when you open up a project, make sure you go to the project properties, and you do the following:
C/C++ Build > Settings > Misc. > Under other flages add this -std=c++11
.
Same thing with GCC C compiler, but this time, you add -std=gnu11
That should set everything up. Don't use Cross GCC, it has always given me problems.
Upvotes: 1