Hi,
I have an existing project with some libraries,I coding in Ubuntu, and using CMake to build my program. Now I want to add urho3d as an external library to add 3D feature for my project, but I dont know how to config my CMakeLists file to make urho3d work with my project.
This is what I did:
- complied and installed Urho3d into my system. (I follow the tutorial in wiki page “Setting-up-a-Project-(CMake)” and it worked so I am sure Urho3d is working now on my pc)
- Copy CMake folder in Urho3D folder into my project folder.
- Create a bin folder with a CoreData and a Data folder inside in my project directory.
- add the following line into my CMakeLists.txt file
# Set CMake modules search path
set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
# Include Urho3D Cmake common module
include (Urho3D-CMake-common)
cmake run with no problem but it had error when I try to “make” a test3D.cpp file
Test3D.cpp:(.text.startup+0x1f): undefined reference to `Urho3D::EventNameRegistrar::RegisterEventName(char const*)'
Test3D.cpp:(.text.startup+0x2e): undefined reference to `Urho3D::StringHash::StringHash(char const*)'
Test3D.cpp:(.text.startup+0x3d): undefined reference to `Urho3D::StringHash::StringHash(char const*)'
Test3D.cpp:(.text.startup+0x4c): undefined reference to `Urho3D::EventNameRegistrar::RegisterEventName(char const*)'
Test3D.cpp:(.text.startup+0x5b): undefined reference to `Urho3D::StringHash::StringHash(char const*)'
Test3D.cpp:(.text.startup+0x6a): undefined reference to `Urho3D::EventNameRegistrar::RegisterEventName(char const*)'
Test3D.cpp:(.text.startup+0x79): undefined reference to `Urho3D::StringHash::StringHash(char const*)'
Test3D.cpp:(.text.startup+0x88): undefined reference to `Urho3D::EventNameRegistrar::RegisterEventName(char const*)'
Test3D.cpp:(.text.startup+0x97): undefined reference to `Urho3D::StringHash::StringHash(char const*)'
Test3D.cpp:(.text.startup+0xa6): undefined reference to `Urho3D::EventNameRegistrar::RegisterEventName(char const*)'
Test3D.cpp:(.text.startup+0xb5): undefined reference to `Urho3D::StringHash::StringHash(char const*)'
Test3D.cpp:(.text.startup+0xc4): undefined reference to `Urho3D::EventNameRegistrar::RegisterEventName(char const*)'
collect2: error: ld returned 1 exit status
my test3d.cpp file
// my first program in C++
#include <string>
#include <sstream>
#include <Urho3D/Core/CoreEvents.h>
// using namespace Urho3D;
int test(int argc, char **argv)
{
printf("hehehehehe\n" );
return 0;
}
Sorry if this is a stupid question, I am new both with urho3d and CMake.
Thank you.