RazeLighter777
RazeLighter777

Reputation: 196

Eclipse Error Highlighting with Auto C++

I am having issues with eclipse c++ syntax highlighting I am using Eclipse-cpp version 4.7.3-1, installed from here: https://www.archlinux.org/packages/?name=eclipse-cpp

I have the following code:

for (auto& i : entityFactories) {
        if (i->getFactoryName() == type) {
            worldEntities.push_back(i->loadEntity(d, *this));
        }

    }

When this code is in eclipse, it is highlighted and marked as "Method could not be resolved". However, the code still built successfully without error.

When I changed the code to

for (EntityFactory* i : entityFactories) {
        if (i->getFactoryName() == type) {
            worldEntities.push_back(i->loadEntity(d, *this));
        }

    }

The issue was resolved. Is this an issue with the auto keyword in Eclipse? Or is there some setting I can change so I can use the auto keyword without any problems? I tried this post here: Eclipse C/C++ Shows Errors but Compiles? but this did not fix my issue.

Upvotes: 0

Views: 626

Answers (1)

Scorta
Scorta

Reputation: 194

You need to config Eclipse to use C++0x or newer. Check out this article: Guide to Eclipse with C++11 standard.

Upvotes: 2

Related Questions