Archive 17/01/2023.

[Solved] How to set up Urho3D (Static, MinGW) in Qt Creator IDE

8Observer8

Hi, all

I try to set up Urho3D (Static, MinGW) in Qt Creator IDE. I use Qt 5.15.2 MinGW. I tried to set up:

But every time I get these errors (848 issues for Urho3D-1.8 and 780 issues for Urho3D-1.7):

For Urho-1.7:
image

For Urho-1.8:
image

As you can see the first errors are the same for Urho-1.7 and Urho-1.8.

I thought may be it is because Qt 5.15 uses “mingw81_32” that is not compatible with Urho MinGW.

I try to write an instruction for beginners. These are my step:

How to set up Urho3D (Static, MinGW) in Qt Creator IDE

It is so simple to setup Urho in Qt Creator IDE on Windows 10:

  1. Download and install Open Source Qt MinGW: Download Qt Open Source
  2. Download and unzip " Urho3D-1.7-MinGW-STATIC.zip", for example, to “E:/Libs” folder
  3. Run Qt Creator and create a new project: “File” > “New File or Project” > “Other Project” > “Empty qmake Project” > click the “Choose…” button > type a name of project, for example: Urho3D_QtCreator > click “Next” > “Next” > “Finish”
  4. Create a “main.cpp” file and copy this code to it:
#include <Urho3D/Engine/Application.h>
#include <iostream>

class MyApp : public Urho3D::Application
{
public:
    MyApp(Urho3D::Context * context) : Urho3D::Application(context)
    {
    }

    virtual void Setup()
    {
        std::cout << "Setup" << std::endl;
    }
};

URHO3D_DEFINE_APPLICATION_MAIN(MyApp)
  1. Copy these settings to the .pro file:

Urho3D_QtCreator.pro

CONFIG += c++11

INCLUDEPATH += "E:\Libs\Urho3D-1.7-MinGW-STATIC\include"
LIBS += -L"E:\Libs\Urho3D-1.7-MinGW-STATIC\lib\Urho3D"
LIBS += -lUrho3D -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -lSetupapi -ladvapi32 -lwinmm -limm32 -lversion -lws2_32 -ldbghelp -lopengl32

SOURCES += \
    main.cpp
  1. Run the project by pressing on the green triangle button in left bottom corner (or Ctrl + R). You will see an empty window created by Urho3D.
8Observer8

I download Urho3D-1.7.1-MinGW-SHARED.zip It works with my instruction above. In addition to my instruction you need to create two folders: “CoreData” and “Data” in your “debug” folder (where .exe is located) because of this error:
image

8Observer8

But I think my information will be useful for developers of Urho3D.

S.L.C

I don’t think you only need to create those. But rather you need to copy the core engine assets. Like shaders and stuff. Because you’ll end up having the same error message but for those files.

As for static linking. There’s a variety of MinGW distributions out there. I honestly suggest msys2. The usual MinGW-w64 from SF died around 8.x version years ago. If you look closely the last release was in 2018-05-24.

And because the MinGW that was used to build the engine might not be the same as yours I’m not entirely sure it will successfully link against each other. Depending on how MinGW libs themselves were linked to the engine.

At this point I suggest building the engine yourself. Every dependency is bundled in and you don’t need anything extra installed other than the compiler. It’s just a mater of installing CMake, pointing it to the source folder and hitting configure/generate. It’s just that easy.

8Observer8

[Tutorial] How to set up Urho3D (Shared, MinGW) in Qt Creator IDE

8Observer8

I built Urho3D from source using CMake-GUI to a static version. But I have the same errors like above but now it is only 132 issues:

image

8Observer8

MINGW_SYSROOT has a value: C:/Qt/Tools/mingw810_32/i686-w64-mingw32 because I use Qt. A static version does not work for me even I build from source.

If STATIC does not want to work for me then I will try to build to SHARED: Problems with building Urho3D to SHARED version from source

S.L.C

Don’t you need URHO3D_STATIC_DEFINE somewhere?

8Observer8

To build the STATIC version of Urho3D for Qt Creator MinGW 8.1.0 you need to use the master branch of Urho3D. The -liphlpapi key is required to avoid this error: image