Hello!
I’m trying to use Urho3D without CMake (on Windows 7 x64), and here is step-by-step, how I’m doing this:
[ul]
[li] Download “Urho3D-1.4-Windows-SHARED.zip” and unpack it;[/li]
[li] Copy “include/Urho3D” and “lib/Urho3D/libUrho3D.dll.a” to “include” and “lib” of my MinGW installation;[/li]
[li] Copy “bin/Urho3D.dll” to my project folder;[/li]
[li] Create “main.cpp” with the following content:
[code]
#include <Urho3D/Urho3D.h>
#include <Urho3D/Core/Context.h>
#include <Urho3D/Engine/Application.h>
#include <Urho3D/Engine/Engine.h>
#include <Urho3D/Input/InputEvents.h>
#include <Urho3D/Math/StringHash.h>
#include <Urho3D/Resource/ResourceCache.h>
#include <Urho3D/UI/Font.h>
#include <Urho3D/UI/Text.h>
#include <Urho3D/UI/UI.h>
using namespace Urho3D;
class Game : public Application
{
OBJECT(Game);
public:
Game(Context* Context) : Application(Context)
{
}
void Setup()
{
engineParameters_["FullScreen"] = false;
}
void Start()
{
SubscribeToEvent(E_KEYDOWN, HANDLER(Game, OnKeyDown));
SharedPtr<Text> text(new Text(context_));
text->SetColor(Color::WHITE);
text->SetFont(GetSubsystem<ResourceCache>()->GetResource<Font>("Fonts/Cinzel Bold.otf"), 42);
text->SetHorizontalAlignment(HA_CENTER);
text->SetText("Okay, it's working now.");
text->SetVerticalAlignment(VA_CENTER);
GetSubsystem<UI>()->GetRoot()->AddChild(text);
}
void Stop()
{
}
private:
void OnKeyDown(StringHash Event, VariantMap &Data)
{
engine_->Exit();
}
};
DEFINE_APPLICATION_MAIN(Game)
[/code][/li]
[li] Build “main.cpp”:
g++ main.cpp -o game.exe -Wpedantic -Wall -Wextra -lmingw32 -lUrho3D -static-libgcc -static-libstdc++
[/li]
[li] Launch output through debugger:
gdb game.exe
[/li][/ul]
After all this steps, I’m always getting segfault: “0x6bd98200 in Urho3D::StringHash::Calculate(char const*) () from …”.
So, I have two simple questions:
[ul]
[li] Am I doing anything wrong?[/li]
[li] Is this possible to use this engine without CMake?[/li][/ul]
P. S.: sorry for my bad English.