Using the engine without CMake


I’m trying to use Urho3D without CMake (on Windows 7 x64), and here is step-by-step, how I’m doing this:
[li] Download “” 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:

#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

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->SetFont(GetSubsystem<ResourceCache>()->GetResource<Font>("Fonts/Cinzel Bold.otf"), 42);
    text->SetText("Okay, it's working now.");


void Stop()

void OnKeyDown(StringHash Event, VariantMap &Data)

[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:
[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. :stuck_out_tongue:


It should be perfectly possible to use the engine that way, however we’re talking about a C++ codebase, so difference in compiler or compiler options can result in there being mismatches in the ABI, which practically means crashes as soon as you start using C++ objects from inside the library.

There is no easy solution to that so I’m starting to doubt if the pre-built binary library downloads should even exist. This would rather force people to build Urho library using the compiler they intend to use. Furthermore, as Urho library can be configured in various ways through the CMake build settings there’s no “right” or canonical configuration.

Thanks for answer!

So, to avoid this segfault, I have to build Urho3D.dll and libUrho3D.dll.a myself, right?

And here goes another question: can I build the engine on Windows without DirectX (which, IIRC, is required to build SDL)?

Yes, you should at least try it to see if it fares better.

When compiling with MinGW on Windows, there is no way around that you need to have the DirectX headers and libs, even for an OpenGL build. Search for “If using MinGW to compile” from … lding.html

Thanks a lot! It works perfectly now! :slight_smile: