lundi 18 décembre 2017

Eclipse C++ No Method proposal when using unique_ptr

I'm having a strange error (Semantic Error) in Eclipse Oxygen C++ with MINGWcompiler.

when I try to use an unique_ptr, eclipse issues an error:

Method 'method_name()' could not be resolved --> Semantic Error.

Example proposal:

#include <iostream>
#include <memory>
#include <string>
using namespace std;

struct Demo {
    Demo(): a(1) {}
    void doSomething() {cout << a << endl}
    int a;
};

int main() {           
    unique_ptr<Demo> demo = make_unique<Demo>();
    demo->doSomething(); //
    return 0;
}

Some fail images:

Eclipse fail _ img

Eclipse fail _ img2

It compiles and work, but the problem never dissappear, any idea to fix it? Is not a problem due to c++14 and make_unique, beacause using a raw pointer it works as well and the problem also persists.

int main() {           
        unique_ptr<Demo> demo (new Demo);
        demo->doSomething(); //
        return 0;
}

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire