Hi All
I'm new to crystalspace and coming back to C++ after a long stint using Java.
I am getting build errors while trying to follow This Tutorial
http://www.crystalspace3d.org/docs/online/1.4/manual/Tutorial-Simple.html#0I get stuck on the very first part on 4.2.1.1 Simple Header File.
First error was with the include path. i saw that my include was /usr/local/include/crystalspace1.4 I renamed it to crystalspace for simplicity and changed the header file to be #include <crystalspace/crystalspace.h> can you confirm this was the correct way to do this?
Next after that I run into the following errors
Header file:
#ifndef SIMPLE_H_
#define SIMPLE_H_
#include <crystalspace/crystalspace.h>
class Simple: public csApplicationFramework, public csBaseEventHandler {
private:
csRef<iEngine> engine;
csRef<iLoader> loader;
csRef<iGraphics3D> g3d;
csRef<iKeyboardDriver> kbd;
csRef<iVirtualClock> vc;
void ProcessFrame();
void FinishFrame();
public:
Simple();
~Simple();
void OnExit();
bool OnInitialize(int argc, char* argv[]);
bool Application();
CS_EVENTHANDLER_NAMES("application.simple1");
CS_EVENTHANDLER_NIL_CONSTRAINTS //PROBLEM
};
class simple {
public:
simple();
virtual ~simple();
};
#endif /* SIMPLE_H_ */
The program is with 'CS_EVENTHANDLER_NIL_CONSTRAINTS' now i understand this is a definition but the error is
- Invalid arguments ' Candidates are: const ? *
GenericSucc(csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &, ?) '
I tried looking for a solution but I could not find any, also I got the impression that this was a part of crystalspace 2.x is that correct?
Cpp file
#include "simple.h"
CS_IMPLEMENT_APPLICATION
Simple::Simple ()
{
SetApplicationName ("CrystalSpace.Simple1");
}
Simple::~Simple ()
{
}
void Simple::ProcessFrame ()
{
}
void Simple::FinishFrame ()
{
}
bool Simple::OnInitialize(int argc, char* argv[])
{
if (!csInitializer::RequestPlugins(GetObjectRegistry(),
CS_REQUEST_VFS,
CS_REQUEST_OPENGL3D,
CS_REQUEST_ENGINE,
CS_REQUEST_FONTSERVER,
CS_REQUEST_IMAGELOADER,
CS_REQUEST_LEVELLOADER,
CS_REQUEST_REPORTER,
CS_REQUEST_REPORTERLISTENER,
CS_REQUEST_END))
return ReportError("Failed to initialize plugins!");
csBaseEventHandler::Initialize(GetObjectRegistry());
if (!RegisterQueue(GetObjectRegistry(), csevAllEvents(GetObjectRegistry())))
return ReportError("Failed to set up event handler!");
return true;
}
void Simple::OnExit()
{
}
bool Simple::Application()
{
if (!OpenApplication(GetObjectRegistry()))
return ReportError("Error opening system!");
g3d = csQueryRegistry<iGraphics3D> (GetObjectRegistry());
if (!g3d) return ReportError("Failed to locate 3D renderer!");
engine = csQueryRegistry<iEngine> (GetObjectRegistry());
if (!engine) return ReportError("Failed to locate 3D engine!");
vc = csQueryRegistry<iVirtualClock> (GetObjectRegistry());
if (!vc) return ReportError("Failed to locate Virtual Clock!");
kbd = csQueryRegistry<iKeyboardDriver> (GetObjectRegistry());
if (!kbd) return ReportError("Failed to locate Keyboard Driver!");
loader = csQueryRegistry<iLoader> (GetObjectRegistry());
if (!loader) return ReportError("Failed to locate Loader!");
Run();
return true;
}
/*---------------*
* Main function
*---------------*/
int main (int argc, char* argv[])
{
return csApplicationRunner<Simple>::Run (argc, argv);
}
The problem is at
if (!RegisterQueue(GetObjectRegistry(), csevAllEvents(GetObjectRegistry())))
With the RegisterQueue I get the error
Invalid arguments '
Candidates are:
bool RegisterQueue(iObjectRegistry *, ?)
bool RegisterQueue(iObjectRegistry *, ? *)
bool RegisterQueue(iEventQueue *, ?)
bool RegisterQueue(iEventQueue *, ? *)
And
if (!OpenApplication(GetObjectRegistry()))
I get the Error
Function 'OpenApplication' could not be resolved
Now Ive taken the approach that the tutorial is correct so I'm guessing its to do with my environment.
I am using Ubuntu and Eclipse IDE. Setup using
http://www.crystalspace3d.org/main/Eclipse_tutorial (yes i substituted the 'cs-config' with '$CRYSTAL/cs-config')
I build and installed crystalspace and included the Environment vars into .bashrc
export CRYSTAL=/home/edward/crystalspace/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/edward/crystalspace/
my include directory is at
/usr/local/include/crystalspace
What have I missed?