cpp-redis / cpp_redis

C++11 Lightweight Redis client: async, thread-safe, no dependency, pipelining, multi-platform
MIT License
713 stars 198 forks source link

Cannot make successfully with -DLOGGING_ENABLED=1 : "error: expected unqualified-id" #79

Open themarwhal opened 3 years ago

themarwhal commented 3 years ago

cpp-redis version : master 99b1dda

Describe the bug I'm following the build instructions here: https://github.com/cpp-redis/cpp_redis/wiki/Mac-&-Linux-Install With the logging enabled flag as described here: https://github.com/cpp-redis/cpp_redis/wiki/Compilation-and-installation-options#enable-logging

The make step fails with:

In file included from /Users/marwhal/Desktop/cpp_redis/sources/builders/array_builder.cpp:23:
In file included from /Users/marwhal/Desktop/cpp_redis/includes/cpp_redis/builders/array_builder.hpp:26:
In file included from /Users/marwhal/Desktop/cpp_redis/includes/cpp_redis/builders/builder_iface.hpp:29:
In file included from /Users/marwhal/Desktop/cpp_redis/includes/cpp_redis/core/reply.hpp:29:
/Users/marwhal/Desktop/cpp_redis/includes/cpp_redis/misc/optional.hpp:59:21: error: expected unqualified-id
    __CPP_REDIS_LOG(1, "value_or(U&& v)\n")
                    ^
2 warnings and 1 error generated.
make[2]: *** [CMakeFiles/cpp_redis.dir/sources/builders/array_builder.cpp.o] Error 1
make[1]: *** [CMakeFiles/cpp_redis.dir/all] Error 2

Versions:

➜  build git:(master) gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.59)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
themarwhal commented 3 years ago

Looks like the solution is to replace the int value with warn/debug/etc as done in this PR (https://github.com/cpp-redis/cpp_redis/pull/69/files).