spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

Failed to generate spdlog into my project

Open Sarah-Callies opened this issue 2 years ago • 3 comments

header_only In file included from ./spdlog/fmt/fmt.h:27:0, from ./spdlog/common.h:50, from spdlog/spdlog.h:12, from server_main.cpp:28: ./spdlog/fmt/bundled/core.h:3293:59: error: macro "print" passed 2 arguments, but takes just 1 FMT_INLINE void print(format_string<T...> fmt, T&&... args) { ^ ./spdlog/fmt/bundled/core.h:3310:73: error: macro "print" passed 3 arguments, but takes just 1 FMT_INLINE void print(std::FILE* f, format_string<T...> fmt, T&&... args) { ^ In file included from ./spdlog/fmt/bundled/core.h:3321:0, from ./spdlog/fmt/fmt.h:27, from ./spdlog/common.h:50, from spdlog/spdlog.h:12, from server_main.cpp:28: ./spdlog/fmt/bundled/format.h:944:43: error: macro "print" passed 2 arguments, but takes just 1 FMT_API void print(std::FILE*, string_view); ^ In file included from ./spdlog/fmt/bundled/format.h:4212:0, from ./spdlog/fmt/bundled/core.h:3321, from ./spdlog/fmt/fmt.h:27, from ./spdlog/common.h:50, from spdlog/spdlog.h:12, from server_main.cpp:28: ./spdlog/fmt/bundled/format-inl.h:1501:51: error: macro "print" passed 2 arguments, but takes just 1 FMT_FUNC void print(std::FILE* f, string_view text) { ^ ./spdlog/fmt/bundled/format-inl.h:1512:50: error: macro "print" passed 3 arguments, but takes just 1 detail::print(f, {buffer.data(), buffer.size()}); ^ In file included from ./spdlog/fmt/fmt.h:27:0, from ./spdlog/common.h:50, from spdlog/spdlog.h:12, from server_main.cpp:28: ./spdlog/fmt/bundled/core.h:3293:17: error: variable or field ‘print’ declared void FMT_INLINE void print(format_string<T...> fmt, T&&... args) { ^~~~~ ./spdlog/fmt/bundled/core.h:3294:3: error: expected primary-expression before ‘const’ const auto& vargs = fmt::make_format_args(args...); ^~~~~ ./spdlog/fmt/bundled/core.h:3294:3: error: expected ‘}’ before ‘const’ ./spdlog/fmt/bundled/core.h:3295:3: error: expected unqualified-id before ‘return’ return detail::is_utf8() ? vprint(fmt, vargs) ^~~~~~ ./spdlog/fmt/bundled/core.h:3310:17: error: variable or field ‘print’ declared void FMT_INLINE void print(std::FILE* f, format_string<T...> fmt, T&&... args) { ^~~~~ ./spdlog/fmt/bundled/core.h:3311:3: error: expected primary-expression before ‘const’ const auto& vargs = fmt::make_format_args(args...); ^~~~~ ./spdlog/fmt/bundled/core.h:3311:3: error: expected ‘}’ before ‘const’ ./spdlog/fmt/bundled/core.h:3312:3: error: expected unqualified-id before ‘return’ return detail::is_utf8() ? vprint(f, fmt, vargs) ^~~~~~ In file included from ./spdlog/fmt/fmt.h:27:0, from ./spdlog/common.h:50, from spdlog/spdlog.h:12, from server_main.cpp:28: ./spdlog/fmt/bundled/core.h:218:5: error: expected declaration before ‘}’ token }
^ ./spdlog/fmt/bundled/core.h:3318:1: note: in expansion of macro ‘FMT_END_NAMESPACE’ FMT_END_NAMESPACE

Sarah-Callies avatar Jan 16 '23 06:01 Sarah-Callies

Please provide the code at line 28 of server_main.cpp and the compiler version information you are using.

tt4g avatar Jan 16 '23 09:01 tt4g

line 28:#include "spdlog/spdlog.h" line 29:#include "spdlog/sinks/basic_file_sink.h" line 30:#include "spdlog/sinks/daily_file_sink.h"

########################################' Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib Thread model: posix gcc version 7.3.0 (GCC)

Sarah-Callies avatar Jan 16 '23 09:01 Sarah-Callies

The root cause of the error appears to be that gcc does not recognize the syntax correctly. Do you have C++11 or higher enabled? Also, are you using the latest version of spdlog?

tt4g avatar Jan 16 '23 10:01 tt4g