Thursday, January 10, 2013

[Eclipse] c++11 support

When i'm trying to use some new features in c++11, for instance, unordered_map class, Eclipse CDT cannot resolve it successfully.

To solve the above problem,  two steps need to be done:

1) Right click on your project->Properties->C/C++ Build->Settings->GCC c++ compiler->misc->Other Flags
Please add "-std=c++0x"

2) After step 1, it may work just fine. But just in case there's still issue on resolving "unordered_map", 
choose:  C/C++ general->Paths and Symbols->symbols
add "__GXX_EXPERIMENTAL_CXX0X__".


Sunday, January 6, 2013

Eclipse CDT semantic errors but can compile, how to fix?

I recently was using Eclipse CDT as an alternative of Visual Studio for development.
And it sometimes shows semantic errors but the project can actually be compiled successfully.

I found this post: http://stackoverflow.com/questions/8148235/eclipse-cdt-shows-semantic-errors-but-compilation-is-ok

To solve it:
Click on File->Properties->C/C++ general->Indexer,
where you will find a tab on the top: Enable project specific settings.
You need to check this box.

Then roll all way down to the bottom, you will find an option:
Build configuration for the indexer.
Choose "Use active build configuration"

This works perfectly for me.