Can't compile/link a new project

Hello, I followed the getting started guide, unzipped the github master, created the project with cmake, launched the solution in Visual Studio and compiled the samples.
All samples work, but now I want to create my own project outside of the Urho3d folder.

I created a new project, added the orho3D include folder to my include folder list, and added the urho3d.lib to my project.
But when I compile, i get the folloing error (and many others…)
LNK2019 unresolved external symbol "public: __thiscall Urho3D::StringHash::StringHash(char const *)" (??0StringHash@Urho3D@@QAE@PBD@Z) referenced in function "void __cdecl Urho3D::DragDropFinish::dynamic initializer for 'P_ACCEPT''(void)" (??__EP_ACCEPT@DragDropFinish@Urho3D@@YAXXZ)

StringHash is defined in StringHash.cpp, but must I add all cpp files to my project ?
Sorry for the newbie question, I used several sdk in the past but here I don’t understand.

Thanks

1 Like

Hi,
I suppose you are using C++?
Here is the guide to setup a project with cmake.

So I can’t just compile with CMake a lib to use for windows builds with all the stuff inside ?

In theory you can, if you already know Urho3D well enough. One can use the pkg-config to setup a working build without using CMake even. That’s the hint to you. In the pkg-config *.pc file there is enough information on how to configure compiler flags, compiler defines, and header and lib search paths, if you should decide to roll one your own.

Also note that the debug build uses: Urho3D_d.lib.

Also check out the Urho3D wiki, especially the first section “Getting started”:

I understood that I need to use pkg-config but on the Doc they say I need to set PKG_CONFIG_PATH to my pkgconfig file but I don’t find this file …

The path should point to where the Urho3D.pc is located. This file is auto-generated when the library is built. So it could be in your build tree if you haven’t installed the SDK.

OK, thanks I will try that…