Include File classes not transferring over...

Ok so I put the Situational Display and TestSD factory method as following:

The Problem that I have is that the Classes that I have highlighted in green give me the error - (name followed by '::' must be a class or namespace)...The classes themselves are in their respective files in this project. The Include files at the top are found and show that it is reading the Include files but the Classes don't seem to transfer over.

<code>
Basic::Object* Factory::createObj(const char* name)
{
Basic::Object* obj = nullptr;

if ( std::strcmp(name, SimStation::getFactoryName()) == 0 ) {
obj = new SimStation();
}
else if ( std::strcmp(name, TestDisplay::getFactoryName()) == 0 ) {
obj = new TestDisplay();
}
else if ( std::strcmp(name, TestIoHandler::getFactoryName()) == 0 ) {
obj = new TestIoHandler();
}
// situational display
else if (std::strcmp(name, TestSD::getFactoryName()) == 0) {
obj = new TestSD;
}
// SituationalDisplay
else if (std::strcmp(name, SituationalDisplay::getFactoryName()) == 0) {
obj = new SituationalDisplay;

}
</code>


I have the Include files linked at the top of the Factory.H file like this:
<code>
#include "TestDisplay.h"
#include "TestIoHandler.h"
#include "SimStation.h"
#include "C:\OpenEaaglesExamples\mainCockpit\TestSD.h"
#include "SituationalDisplay.h"
#include "xPanel/Factory.h"
</code>

The classes for example are in their files like this:
<code>
class SituationalDisplay : public BasicGL::Page
{
DECLARE_SUBCLASS(SituationalDisplay,BasicGL::Page)

enum { NCHAR_NAV1_ID = 3, NCHAR_NAV2_ID = 5 };
and so on.......
</code>

They are perfectly linked to the Factory.h file. How would I be able to get the classes to be noticed?
Thanks,
Djpich
Last edited on
closed account (48T7M4Gy)
code blocks have [ ] not < > Just anther small challenge, good you tried though. :)
Hi,

Is Basic supposed to be BasicGL ?

Do you need a forward declaration of Basic::Object ?

I don't see an include for it, presumably it is a class.

Also, I don't see where you return a Basic::Object pointer, as the function requires. If obj is a class member, maybe the function should be void ?

Can you post the exact error - verbatim, and make sure the line numbers match the code you post.

Use the <> button on the format menu when you edit your post, so we can see the code formatted properly.
Topic archived. No new replies allowed.