Hi, I’m now able to build URHO3D without much trouble with the options I need. But I’m still in the early beginning with URHO…
I started recently with MSVC and CODELITE (Mingw32) to try to use the lib externally but it fail all the time. I come from the Irrlicht world, and I was used to use a library this way:
- set the path of the include files and the compiled library file (.a or .lib) for the used library, in the compiler settings.
- set the name of the library to the linker setting.
- Use the “hello world” example and try to compile.
Results:
C:\WINDOWS\system32\cmd.exe /C C:/TDM-GCC-64/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ Test - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Public/Projets/Test'
mingw32-make.exe[1]: Leaving directory 'C:/Users/Public/Projets/Test'
mingw32-make.exe[1]: Entering directory 'C:/Users/Public/Projets/Test'
C:/TDM-GCC-64/bin/g++.exe -c "C:/Users/Public/Projets/Test/main.cpp" -g -O0 -Wall -o ./Debug/main.cpp.o -I. -I../URHO/Codelite/Include -I../URHO/Codelite/Include/Audio -I../URHO/Codelite/Include/Container -I../URHO/Codelite/Include/Core -I../URHO/Codelite/Include/Database -I../URHO/Codelite/Include/Engine -I../URHO/Codelite/Include/Graphics -I../URHO/Codelite/Include/Input -I../URHO/Codelite/Include/IO -I../URHO/Codelite/Include/LuaScript -I../URHO/Codelite/Include/Math -I../URHO/Codelite/Include/Navigation -I../URHO/Codelite/Include/Network -I../URHO/Codelite/Include/Physics -I../URHO/Codelite/Include/Resource -I../URHO/Codelite/Include/Scene -I../URHO/Codelite/Include/Script -I../URHO/Codelite/Include/ThirdParty -I../URHO/Codelite/Include/ThirdParty/AngelScript -I../URHO/Codelite/Include/ThirdParty/Box2D -I../URHO/Codelite/Include/ThirdParty/Bullet -I../URHO/Codelite/Include/ThirdParty/Civetweb -I../URHO/Codelite/Include/ThirdParty/Detour -I../URHO/Codelite/Include/ThirdParty/DetourCrowd -I../URHO/Codelite/Include/ThirdParty/DetourTileCache -I../URHO/Codelite/Include/ThirdParty/freetype -I../URHO/Codelite/Include/ThirdParty/GLEW -I../URHO/Codelite/Include/ThirdParty/JO -I../URHO/Codelite/Include/ThirdParty/kNet -I../URHO/Codelite/Include/ThirdParty/libCpuId -I../URHO/Codelite/Include/ThirdParty/Lua -I../URHO/Codelite/Include/ThirdParty/LZ4 -I../URHO/Codelite/Include/ThirdParty/PugiXml -I../URHO/Codelite/Include/ThirdParty/rapidjson -I../URHO/Codelite/Include/ThirdParty/Recast -I../URHO/Codelite/Include/ThirdParty/SDL -I../URHO/Codelite/Include/ThirdParty/StanHull -I../URHO/Codelite/Include/ThirdParty/STB -I../URHO/Codelite/Include/ThirdParty/toluapp -I../URHO/Codelite/Include/UI -I../URHO/Codelite/Include/Urho2D
C:/Users/Public/Projets/Test/main.cpp:13:24: error: expected constructor, destructor, or type conversion before '(' token
DEFINE_APPLICATION_MAIN(HelloWorld)
^
C:/Users/Public/Projets/Test/main.cpp:20:6: error: 'HelloWorld' has not been declared
void HelloWorld::Start()
^
C:/Users/Public/Projets/Test/main.cpp: In function 'void Start()':
C:/Users/Public/Projets/Test/main.cpp:23:5: error: 'Sample' has not been declared
Sample::Start();
^
C:/Users/Public/Projets/Test/main.cpp:26:16: error: 'CreateText' was not declared in this scope
CreateText();
^
C:/Users/Public/Projets/Test/main.cpp:31:23: error: 'SubscribeToEvents' was not declared in this scope
SubscribeToEvents();
^
C:/Users/Public/Projets/Test/main.cpp: At global scope:
C:/Users/Public/Projets/Test/main.cpp:34:6: error: 'HelloWorld' has not been declared
void HelloWorld::CreateText()
^
C:/Users/Public/Projets/Test/main.cpp: In function 'void CreateText()':
C:/Users/Public/Projets/Test/main.cpp:36:5: error: 'ResourceCache' was not declared in this scope
ResourceCache* cache = GetSubsystem<ResourceCache>();
^
C:/Users/Public/Projets/Test/main.cpp:36:5: note: suggested alternative:
In file included from ../URHO/Codelite/Include/Urho3D/Input/../UI/../UI/BorderImage.h:26:0,
from ../URHO/Codelite/Include/Urho3D/Input/../UI/Cursor.h:27,
from ../URHO/Codelite/Include/Urho3D/Input/Input.h:30,
from C:/Users/Public/Projets/Test/main.cpp:7:
../URHO/Codelite/Include/Urho3D/Input/../UI/../UI/../UI/UIElement.h:109:7: note: 'Urho3D::ResourceCache'
class ResourceCache;
^
C:/Users/Public/Projets/Test/main.cpp:36:20: error: 'cache' was not declared in this scope
ResourceCache* cache = GetSubsystem<ResourceCache>();
^
C:/Users/Public/Projets/Test/main.cpp:36:28: error: 'GetSubsystem' was not declared in this scope
ResourceCache* cache = GetSubsystem<ResourceCache>();
^
C:/Users/Public/Projets/Test/main.cpp:36:56: error: expected primary-expression before ')' token
ResourceCache* cache = GetSubsystem<ResourceCache>();
^
C:/Users/Public/Projets/Test/main.cpp:39:5: error: 'SharedPtr' was not declared in this scope
SharedPtr<Text> helloText(new Text(context_));
^
C:/Users/Public/Projets/Test/main.cpp:39:5: note: suggested alternative:
In file included from ../URHO/Codelite/Include/Urho3D/Core/../Core/../Core/Variant.h:26:0,
from ../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:26,
from ../URHO/Codelite/Include/Urho3D/Core/CoreEvents.h:25,
from C:/Users/Public/Projets/Test/main.cpp:4:
C:/Users/Public/Projets/URHO/Codelite/Include/Urho3D/Container/Ptr.h:34:26: note: 'Urho3D::SharedPtr'
template <class T> class SharedPtr
^
C:/Users/Public/Projets/Test/main.cpp:39:15: error: 'Text' was not declared in this scope
SharedPtr<Text> helloText(new Text(context_));
^
C:/Users/Public/Projets/Test/main.cpp:39:15: note: suggested alternative:
In file included from C:/Users/Public/Projets/Test/main.cpp:9:0:
../URHO/Codelite/Include/Urho3D/UI/Text.h:73:18: note: 'Urho3D::Text'
class URHO3D_API Text : public UIElement
^
C:/Users/Public/Projets/Test/main.cpp:39:35: error: expected type-specifier before 'Text'
SharedPtr<Text> helloText(new Text(context_));
^
C:/Users/Public/Projets/Test/main.cpp:39:49: error: 'helloText' was not declared in this scope
SharedPtr<Text> helloText(new Text(context_));
^
C:/Users/Public/Projets/Test/main.cpp:45:43: error: 'Font' was not declared in this scope
helloText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 30);
^
C:/Users/Public/Projets/Test/main.cpp:45:43: note: suggested alternative:
In file included from C:/Users/Public/Projets/Test/main.cpp:6:0:
../URHO/Codelite/Include/Urho3D/UI/Font.h:46:18: note: 'Urho3D::Font'
class URHO3D_API Font : public Resource
^
C:/Users/Public/Projets/Test/main.cpp:46:47: error: 'Color' was not declared in this scope
helloText->SetColor(Color(0.0f, 1.0f, 0.0f));
^
C:/Users/Public/Projets/Test/main.cpp:46:47: note: suggested alternative:
In file included from ../URHO/Codelite/Include/Urho3D/Core/../Core/../Core/Variant.h:27:0,
from ../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:26,
from ../URHO/Codelite/Include/Urho3D/Core/CoreEvents.h:25,
from C:/Users/Public/Projets/Test/main.cpp:4:
C:/Users/Public/Projets/URHO/Codelite/Include/Urho3D/Math/Color.h:36:18: note: 'Urho3D::Color'
class URHO3D_API Color
^
C:/Users/Public/Projets/Test/main.cpp:49:39: error: 'HA_CENTER' was not declared in this scope
helloText->SetHorizontalAlignment(HA_CENTER);
^
C:/Users/Public/Projets/Test/main.cpp:49:39: note: suggested alternative:
In file included from ../URHO/Codelite/Include/Urho3D/Input/../UI/../UI/BorderImage.h:26:0,
from ../URHO/Codelite/Include/Urho3D/Input/../UI/Cursor.h:27,
from ../URHO/Codelite/Include/Urho3D/Input/Input.h:30,
from C:/Users/Public/Projets/Test/main.cpp:7:
../URHO/Codelite/Include/Urho3D/Input/../UI/../UI/../UI/UIElement.h:37:5: note: 'HA_CENTER'
HA_CENTER,
^
C:/Users/Public/Projets/Test/main.cpp:50:37: error: 'VA_CENTER' was not declared in this scope
helloText->SetVerticalAlignment(VA_CENTER);
^
C:/Users/Public/Projets/Test/main.cpp:50:37: note: suggested alternative:
In file included from ../URHO/Codelite/Include/Urho3D/Input/../UI/../UI/BorderImage.h:26:0,
from ../URHO/Codelite/Include/Urho3D/Input/../UI/Cursor.h:27,
from ../URHO/Codelite/Include/Urho3D/Input/Input.h:30,
from C:/Users/Public/Projets/Test/main.cpp:7:
../URHO/Codelite/Include/Urho3D/Input/../UI/../UI/../UI/UIElement.h:45:5: note: 'VA_CENTER'
VA_CENTER,
^
C:/Users/Public/Projets/Test/main.cpp:53:18: error: 'UI' was not declared in this scope
GetSubsystem<UI>()->GetRoot()->AddChild(helloText);
^
C:/Users/Public/Projets/Test/main.cpp:53:18: note: suggested alternative:
In file included from C:/Users/Public/Projets/Test/main.cpp:10:0:
../URHO/Codelite/Include/Urho3D/UI/UI.h:43:18: note: 'Urho3D::UI'
class URHO3D_API UI : public Object
^
C:/Users/Public/Projets/Test/main.cpp:53:22: error: expected primary-expression before ')' token
GetSubsystem<UI>()->GetRoot()->AddChild(helloText);
^
C:/Users/Public/Projets/Test/main.cpp: At global scope:
C:/Users/Public/Projets/Test/main.cpp:56:6: error: 'HelloWorld' has not been declared
void HelloWorld::SubscribeToEvents()
^
C:/Users/Public/Projets/Test/main.cpp: In function 'void SubscribeToEvents()':
C:/Users/Public/Projets/Test/main.cpp:59:22: error: 'E_UPDATE' was not declared in this scope
SubscribeToEvent(E_UPDATE, HANDLER(HelloWorld, HandleUpdate));
^
C:/Users/Public/Projets/Test/main.cpp:59:22: note: suggested alternative:
In file included from ../URHO/Codelite/Include/Urho3D/Core/CoreEvents.h:25:0,
from C:/Users/Public/Projets/Test/main.cpp:4:
../URHO/Codelite/Include/Urho3D/Core/CoreEvents.h:38:7: note: 'Urho3D::E_UPDATE'
EVENT(E_UPDATE, Update)
^
../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:287:67: note: in definition of macro 'EVENT'
#define EVENT(eventID, eventName) static const Urho3D::StringHash eventID(#eventName); namespace eventName
^
C:/Users/Public/Projets/Test/main.cpp:59:40: error: 'HelloWorld' was not declared in this scope
SubscribeToEvent(E_UPDATE, HANDLER(HelloWorld, HandleUpdate));
^
../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:291:68: note: in definition of macro 'HANDLER'
#define HANDLER(className, function) (new Urho3D::EventHandlerImpl<className>(this, &className::function))
^
../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:291:77: error: template argument 1 is invalid
#define HANDLER(className, function) (new Urho3D::EventHandlerImpl<className>(this, &className::function))
^
C:/Users/Public/Projets/Test/main.cpp:59:32: note: in expansion of macro 'HANDLER'
SubscribeToEvent(E_UPDATE, HANDLER(HelloWorld, HandleUpdate));
^
../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:291:79: error: invalid use of 'this' in non-member function
#define HANDLER(className, function) (new Urho3D::EventHandlerImpl<className>(this, &className::function))
^
C:/Users/Public/Projets/Test/main.cpp:59:32: note: in expansion of macro 'HANDLER'
SubscribeToEvent(E_UPDATE, HANDLER(HelloWorld, HandleUpdate));
^
C:/Users/Public/Projets/Test/main.cpp:59:40: error: 'HelloWorld' is not a class or namespace
SubscribeToEvent(E_UPDATE, HANDLER(HelloWorld, HandleUpdate));
^
../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:291:86: note: in definition of macro 'HANDLER'
#define HANDLER(className, function) (new Urho3D::EventHandlerImpl<className>(this, &className::function))
^
C:/Users/Public/Projets/Test/main.cpp:59:65: error: 'SubscribeToEvent' was not declared in this scope
SubscribeToEvent(E_UPDATE, HANDLER(HelloWorld, HandleUpdate));
^
C:/Users/Public/Projets/Test/main.cpp: At global scope:
C:/Users/Public/Projets/Test/main.cpp:62:6: error: 'HelloWorld' has not been declared
void HelloWorld::HandleUpdate(StringHash eventType, VariantMap& eventData)
^
C:/Users/Public/Projets/Test/main.cpp:62:31: error: variable or field 'HandleUpdate' declared void
void HelloWorld::HandleUpdate(StringHash eventType, VariantMap& eventData)
^
C:/Users/Public/Projets/Test/main.cpp:62:31: error: 'StringHash' was not declared in this scope
C:/Users/Public/Projets/Test/main.cpp:62:31: note: suggested alternative:
In file included from ../URHO/Codelite/Include/Urho3D/Core/../Core/../Core/Variant.h:31:0,
from ../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:26,
from ../URHO/Codelite/Include/Urho3D/Core/CoreEvents.h:25,
from C:/Users/Public/Projets/Test/main.cpp:4:
C:/Users/Public/Projets/URHO/Codelite/Include/Urho3D/Math/StringHash.h:31:18: note: 'Urho3D::StringHash'
class URHO3D_API StringHash
^
C:/Users/Public/Projets/Test/main.cpp:62:53: error: 'VariantMap' was not declared in this scope
void HelloWorld::HandleUpdate(StringHash eventType, VariantMap& eventData)
^
C:/Users/Public/Projets/Test/main.cpp:62:53: note: suggested alternative:
In file included from ../URHO/Codelite/Include/Urho3D/Core/../Core/Object.h:26:0,
from ../URHO/Codelite/Include/Urho3D/Core/CoreEvents.h:25,
from C:/Users/Public/Projets/Test/main.cpp:4:
../URHO/Codelite/Include/Urho3D/Core/../Core/../Core/Variant.h:109:38: note: 'Urho3D::VariantMap'
typedef HashMap<StringHash, Variant> VariantMap;
^
C:/Users/Public/Projets/Test/main.cpp:62:65: error: 'eventData' was not declared in this scope
void HelloWorld::HandleUpdate(StringHash eventType, VariantMap& eventData)
^
mingw32-make.exe[1]: *** [Debug/main.cpp.o] Error 1
mingw32-make.exe: *** [All] Error 2
Test.mk:97: recipe for target 'Debug/main.cpp.o' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Public/Projets/Test'
Makefile:4: recipe for target 'All' failed
====33 errors, 38 warnings====
From the docs, it tell to use CMAKE to prepare something for the compilation. I’m really confused now.
Is there a way to use the URHO3D lib without having to use CMAKE to make our own workspace/project? Is there a tutorial somewhere, where I could use it the way I’m used to? I just want to create a new C++ project and use the features of URHO3D, I don’t want to “patch” the helloworld file example to add my stuff.