Search code examples
c++multithreadingmutexeclipse-cdt

eclipse show error on mutex type , despite the fact that compilation passed ok


Use eclipse-cdt (latest version ) on Ubuntu. I create new project with one line code - mutex declarative.

compilation passed (compile with eclipse), but eclipse mark the mutex in red and complain on - 'mutex type could not be resolved'

i add ' -std=c++0x -pthread' to the g++ and refresh eclipse indexer, but didnt help.

Any advice?

#include <mutex>
using namespace std;

static mutex m;

int main(int argc, char *argv[]) {
}

Solution

  • C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste __GXX_EXPERIMENTAL_CXX0X__ (ensure to append and prepend two underscores) into "Name" and leave "Value" blank.

    This solve it.