Hi, I have been trying to add a test class to one of the engine modules, in a public header, using the standard method to expose the new class/function to other modules.
However, every time I try to rebuild the engine from the source after being edited, build fails and all sort of errors appear, among them multiple errors stating there’re redefinitions of classes in the header that was edited. Other errors are in totally different files where some macros render “undefined identifier” to the compiler, to name a few other errors.
I started by cloning, and forking the branch 4-27, and it is correctly built if I don’t make any edit; Once I add anything to the source, it is not buildable.
Here is the class I added to the header WindowsApplication.h (a public header in the module ApplicationCore):
//..
//..untouched code lines.
//..
#define WINDOWS_APPLICATION_H_MY_PROJECT_ADDITION 1
//..
//..other code lines(untouched).
//..
//These lines are added to the existing class FWindowsApplication:
class APPLICATIONCORE_API FWindowsApplication
: public GenericApplication
, public IForceFeedbackSystem
{
#if WINDOWS_APPLICATION_H_MY_PROJECT_ADDITION
friend class FXInputProxy_;
#endif // WINDOWS_APPLICATION_H_MY_PROJECT_ADDITION
//..
//..other code lines(untouched).
//..
}
#if WINDOWS_APPLICATION_H_MY_PROJECT_ADDITION
class APPLICATIONCORE_API FXInputProxy_
{
public:
FXInputProxy_() = delete;
FXInputProxy_(FWindowsApplication* InWinApp);
private:
FWindowsApplication* WinApp = nullptr;
XInputInterface* XInput = nullptr;
public:
void Poll(short InRaw[]);
};
#endif // WINDOWS_APPLICATION_H_MY_PROJECT_ADDITION
Then inside the source code of the header (WindowsApplication.cpp),
I added those lines of code:
#if WINDOWS_APPLICATION_H_MY_PROJECT_ADDITION
FXInputProxy_::FXInputProxy_(FWindowsApplication* InWinApp)
{
//Function not yet implemented!
}
void FXInputProxy_::Poll(short InRaw[])
{
//Function not yet implemented!
}
#endif // WINDOWS_APPLICATION_H_MY_PROJECT_ADDITION