spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

spdlog/sinks/callback_sink.h: No such file or directory

Open hbZhao9 opened this issue 2 years ago • 1 comments

I am trying to integrate the spdlog into my project. However I get the below error when I run the example code. ` build$ cmake ../ -- The CXX compiler identification is GNU 9.4.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Configuring done -- Generating done -- Build files have been written to: /home/machine/spdlog/example/build

build$ make Scanning dependencies of target example [ 50%] Building CXX object CMakeFiles/example.dir/example.cpp.o /home/machine/spdlog/example/example.cpp:139:10: fatal error: spdlog/sinks/callback_sink.h: No such file or directory 139 | #include "spdlog/sinks/callback_sink.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [CMakeFiles/example.dir/build.make:63: CMakeFiles/example.dir/example.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/example.dir/all] Error 2 make: *** [Makefile:84: all] Error 2 `

The operating system is Ubuntu 20.04. Run sudo apt install libspdlog-dev to install the package.

hbZhao9 avatar May 05 '23 20:05 hbZhao9

If you have sudo apt install libspdlog-dev to install spdlog on your machine, you do not need to build spdlog. Since it is specified as a dependency of libspdlog-dev, libspdlog1 should also be installed.

And since the commit 3cab260814613b0a7e6889d2a030b2992c916d1a with the callback_sink added has not yet been released, you are trying to build a different source code than libspdlog-dev. The project incorporates the latest spdlog source code, but the included header files appear to refer to the source code installed on the machine by libspdlog-dev.

I can only assume that there is a problem with your project.

tt4g avatar May 06 '23 01:05 tt4g