dgnorton / libtvdb

C API for TVDB (http://bit.ly/bE4F6V)
2 stars 2 forks source link

Can't build #1

Open carlosmanri opened 7 years ago

carlosmanri commented 7 years ago

Hi, I tried to build the library using cmake CmakeLists.txt and I get the next error: CMake Error at cmake/modules/MacroOutOfSourceBuild.cmake:10 (MESSAGE): libtvdb requires an out of source build. What is happening?

dgnorton commented 7 years ago

@Manri98 The error message means that builds can't be run in the source directory tracked by git. Here's the solution:

cd build && cmake ..

If that runs successfully, edit libtvdb/src/tvdb_key.h to include your TVDB API key. Then run make in the build dir. If that runs successfully, a static library should be generated...

build/src/libtvdb.a

If you ran into missing dependencies during the build, make sure libcurl and libxml2 are installed. On Debian or Ubuntu:

sudo apt-get install libcurl4-gnutls-dev libxml2-dev
dgnorton commented 7 years ago

Also, once you get it building, there is some example code here.

carlosmanri commented 7 years ago

Thank you so much, got it. So no if I want to use the functions I can just include the .a file or I need to link it when I compile it.

dgnorton commented 7 years ago

Copy tvdb_key_template.h to a file named tvdb_key.h and then edit it to use your TVDB API key. In your code that will use the functions:

#include "tvdb.h"
#include "tvdb_key.h"

And, you will need to link in libtvdb.a at compile time.

carlosmanri commented 7 years ago

Excuse me again but I have another issue. When I init libtvdb with htvdb_t tvdb = tvdb_init(MY_API_KEY); I get the next error: error: undefined reference to tvdb_init(char const*) but tvdb_init is already defined in tvdb.h