Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » CDT » C++11 and indexer [RESOLVED]
C++11 and indexer [RESOLVED] [message #763373] Fri, 09 December 2011 11:50 Go to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
Hello,

I a m trying to enter the C++11 world, and CDT doesn't recognize

#include <unordered_map>


I have no problem when compiling in command line.

Is there something to do so that the parser does work with C++11 stuff ?

I use the Indigo version. Maybe the nightly build doesn't have the problem anymore ?

Thanks.

[Updated on: Wed, 21 December 2011 10:24]

Report message to a moderator

Re: using C++11 with CDT and gcc 4.5.3 [message #764517 is a reply to message #763373] Mon, 12 December 2011 05:39 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1827
Registered: July 2009
Senior Member
What's your specific problem? When I add
#include <unordered_map>

to my code I have no problem.
Perhaps there is some define missing (to use the C++11 code)?

Eclipse CDT Indigo, gcc 4.4.3, Ubuntu


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: using C++11 with CDT and gcc 4.5.3 [message #764618 is a reply to message #764517] Mon, 12 December 2011 09:41 Go to previous messageGo to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
My paths were poorly set.

Now, the include is OK (I can access the unordered_map from there), but unordered_map isn't recogniezd in the code : Symbol 'unordered_map' could not be resolved

I use it as std::unordered_map.
Re: using C++11 with CDT and gcc 4.5.3 [message #765013 is a reply to message #764618] Tue, 13 December 2011 04:01 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1827
Registered: July 2009
Senior Member
I guess you have to add the following option for the compiler "-std=c++0x".

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: using C++11 with CDT and gcc 4.5.3 [message #765630 is a reply to message #765013] Wed, 14 December 2011 07:22 Go to previous messageGo to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
Where ?

I don't use Eclipse to compile, because I compile through network with distcc.
But if there is a solution to set it thsi configuration in Eclipse, it is welcome. Smile
Re: using C++11 with CDT and gcc 4.5.3 [message #766109 is a reply to message #765630] Thu, 15 December 2011 03:43 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1827
Registered: July 2009
Senior Member
Oodini wrote on Wed, 14 December 2011 13:22
Where ?

I don't use Eclipse to compile, because I compile through network with distcc.
But if there is a solution to set it thsi configuration in Eclipse, it is welcome. Smile

The option "-std=c++0x" sets a special define. You should add this define to your project (Project properties->C/C++ general->Paths and Symbols


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: using C++11 with CDT and gcc 4.5.3 [message #769012 is a reply to message #766109] Wed, 21 December 2011 03:45 Go to previous messageGo to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
Well, when I set that in the Synbols tab, "-std=c++0x" is splitted in two parts : std and c++0x...
Re: using C++11 with CDT and gcc 4.5.3 [message #769019 is a reply to message #769012] Wed, 21 December 2011 04:09 Go to previous messageGo to next message
Andris Zeila is currently offline Andris Zeila
Messages: 2
Registered: November 2011
Junior Member
Setting __GXX_EXPERIMENTAL_CXX0X__ define in project options/c++/symbols worked for me.
Re: using C++11 with CDT and gcc 4.5.3 [message #769208 is a reply to message #769019] Wed, 21 December 2011 10:20 Go to previous messageGo to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
Thanks a lot ! It does work.
Re: C++11 and indexer [RESOLVED] [message #871440 is a reply to message #763373] Sun, 13 May 2012 14:20 Go to previous messageGo to next message
Nobody Mising name is currently offline Nobody Mising name
Messages: 64
Registered: July 2010
Member
Doesn't work for me:
#include <iostream>
#include <memory>
#include <string>
#include <unordered_map>
using namespace std;

int main()
{
    shared_ptr<string> ptr(new string("str"));
    auto i = ptr->find("t"); // <=== 'find' could not be resolved
    cout << i << endl;      // <=== Invalid overload of 'endl'
    unordered_map<int, string> m; // <=== invalid template arguments
}


Using mingw gcc 4.7 and CDT 8.0.2.201202111925, added "-std=c++11" to compiler and discovery options. The macro __GXX_EXPERIMENTAL_CXX0X__ is among built-in values in Symbols.

Can anyone help?


Reproduced with CDT 8.1.0.201205092110.

[Updated on: Sun, 13 May 2012 16:48]

Report message to a moderator

Re: C++11 and indexer [RESOLVED] [message #872152 is a reply to message #871440] Tue, 15 May 2012 10:50 Go to previous messageGo to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
The tool chain must also be set.
Re: C++11 and indexer [RESOLVED] [message #872676 is a reply to message #872152] Wed, 16 May 2012 11:21 Go to previous messageGo to next message
Nobody Mising name is currently offline Nobody Mising name
Messages: 64
Registered: July 2010
Member
Harry Houdini wrote on Tue, 15 May 2012 10:50
The tool chain must also be set.

Created new hello world project with MinGW toolchain. So it is set. Discovery options works as expected. The problem is with indexer, why it doesn't recognize symbols?
Re: C++11 and indexer [RESOLVED] [message #879052 is a reply to message #872676] Wed, 30 May 2012 08:48 Go to previous messageGo to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
Did you resolve your problem ?
Re: C++11 and indexer [RESOLVED] [message #879499 is a reply to message #879052] Thu, 31 May 2012 06:19 Go to previous message
Andrey Eremchenko is currently offline Andrey Eremchenko
Messages: 7
Registered: July 2009
Junior Member
No, still not resolved. But I have switched to MinGW GCC 4.6.3 and it seems that CDT doesn't have described problems with this version.
Previous Topic:Linker dependency isn't working
Next Topic:Make Indexer aware of gcc "-D" defines specified in non-eclipse Makefile?
Goto Forum:
  


Current Time: Thu May 23 01:59:46 EDT 2013

Powered by FUDForum. Page generated in 0.02002 seconds