Cylix/cpp_redis

Help including in project

moritzmoritz opened this issue · 5 comments

Hello!

I'm kindly new to c++ and I don't get what is my mistake.

I set the header search path and library search path where I copied everything from "includes".

Xcode does notice the lib but I always get 'cpp_redis/core/client.hpp' file not found

screen shot 2018-01-20 at 13 20 15

My paths are set like this:

screen shot 2018-01-20 at 13 21 20

So what am I doing wrong? :( Sorry for this very beginning question. I'm developing in my daily work with swift and python ...

Thanks!

Cylix commented

Hi,

Sorry to hear you got some troubles while using this library.
I'm not very familiar with XCode (I only used it a few times in the past for objective C development). I googled a bit and I found this stackoverflow post: https://stackoverflow.com/questions/32618920/attempting-to-include-a-library-in-xcode-file-not-found

Seems like they mention to put some doubles quotes and to include a trailing slash in the path configuration.
Could you try that and let me know if that solves your issue?

Best!

Thanks for your reply! That does not fix my problem. I'ms till getting 'cpp_redis/core/client.hpp' file not found as Build-Error.
Inside the lib the include paths all start with cpp_redis/..:

#include <cpp_redis/core/client.hpp>
#include <cpp_redis/core/subscriber.hpp>
#include <cpp_redis/core/reply.hpp>
#include <cpp_redis/misc/error.hpp>
#include <cpp_redis/misc/logger.hpp>

My Xcode finds the lib, but can not deal with the paths inside..

screen shot 2018-01-22 at 10 10 26

screen shot 2018-01-22 at 10 09 51

Now I've build the lib with cmake and it is in my /usr/local/include-Folder. But now I get a linker error:

Undefined symbols for architecture x86_64:
  "cpp_redis::client::sync_commit()", referenced from:
      greet() in main.o
  "cpp_redis::client::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (cpp_redis::reply&)> const&)", referenced from:
      greet() in main.o
  "cpp_redis::client::set(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      greet() in main.o
  "cpp_redis::client::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, cpp_redis::client::connect_state)> const&, unsigned int, int, unsigned int)", referenced from:
      greet() in main.o
  "cpp_redis::client::client()", referenced from:
      greet() in main.o
  "cpp_redis::client::~client()", referenced from:
      greet() in main.o
  "operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cpp_redis::reply const&)", referenced from:
      greet()::$_0::operator()(cpp_redis::reply&) const in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Cylix commented

Hi,

Did you specify to link against cpp_redis, as well as updating the library path such that it can find the folder containing libcpp_redis.a?

I found an example about how to set these flags on XCode here: https://stackoverflow.com/questions/445815/linking-libraries-in-xcode .

Let me know if it solves the issue :)

Best

Cylix commented

I'm closing this issue, but feel free to re-open if you are still unable to link your program with cpp_redis.

Best