Eclipse-CDT: Base class ” not in include paths for current project

eclipseDon’t you just hate weird things like this? You have a nice little project in Eclipse, it’s all is working fine, auto-complete, build, everything.

BUT:

When you try to add a new class using the File -> New -> Class menu, you get this error:

Base class 'myclassname' not in include paths for current project.

Doh!

This one is easy to fix.

When you are in the dialog box to add the base class, make sure the Qualified name and location field is the path to the class in your current project.

If you have multiple open projects in Eclipse, any match for a class name will appear, even if it isn’t in the project you are working on.

You can close your other projects in the project explorer window by right clicking and selecting Close Project. That will stop you accidentally specifying the wrong class as Eclipse will only look for classes in the project you have open.

So there you have it. Once you’ve selected the right class header file from the right project, the nasty error will go away.

Phew.