If your Eclipse Juno with ADT plugin can compile C++11 code but fails to resolve C++11 symbols, here is the procedure:
Open your .cproject
file in a text editor.
Search the following line (where XXXXXXXXX is a random number):
<tool id="com.android.gcc.compiler.XXXXXXXXX" name="Android GCC Compiler" superClass="com.android.gcc.compiler">
Add the following into it:
<option id="com.android.gcc.compiler.option.preprocessor.def.768340103" superClass="com.android.gcc.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="true" value="__cplusplus=201103L"/>
<listOptionValue builtIn="false" value="__cplusplus=201103L"/>
<listOptionValue builtIn="true" value="__GXX_EXPERIMENTAL_CXX0X__"/>
<listOptionValue builtIn="false" value="__GXX_EXPERIMENTAL_CXX0X__"/>
</option>
You should have something like this (where YYYYYYYYYY is also a random number):
<tool id="com.android.gcc.compiler.XXXXXXXXX" name="Android GCC Compiler" superClass="com.android.gcc.compiler">
<option id="com.android.gcc.compiler.option.preprocessor.def.768340103" superClass="com.android.gcc.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="true" value="__cplusplus=201103L"/>
<listOptionValue builtIn="false" value="__cplusplus=201103L"/>
<listOptionValue builtIn="true" value="__GXX_EXPERIMENTAL_CXX0X__"/>
<listOptionValue builtIn="false" value="__GXX_EXPERIMENTAL_CXX0X__"/>
</option>
<inputType id="com.android.gcc.inputType.YYYYYYYYYY" superClass="com.android.gcc.inputType"/>
</tool>
Save modifications, restart eclipse and if C++11 symbols are still not resolved rebuild your index (right click on the project → "Index" → "Rebuild").
Because the "Symbols" tab was not visible in the C/C++ options of the project, I was forced to add these lines manually in the .cproject
file in order to set the value of __cplusplus
to 201103L
.
I don't know exactly how .cproject files works so there's probably a better way to do it. I've seen some guys changing the toolset options of the project in order to make the "Symbols" tab visible (here Android NDK build, Method could not be resolved and here Setting up C++11 (std::thread) for NDK with ADT/Eclipse).