You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just wanted to provide some feedback in case someone encounters an issue similar to mine when trying to compile with FMTLOG_HEADER_ONLY.
For reference, I installed fmtlib through sudo apt install libfmt-dev on Linux Mint 21.3.
I tried to compile the following minimal example with g++ -std=c++17 -o myprogram source.cpp.
#define FMTLOG_HEADER_ONLY
#include "fmtlog.h"
int main()
{
FMTLOG(fmtlog::INF, "The answer is {}.", 42);
}
which fails with a ton of errors like
/usr/bin/ld: /tmp/ccpnEvRi.o: in function `std::make_unsigned<int>::type fmt::v8::detail::to_unsigned<int>(int)':
source.cpp:(.text._ZN3fmt2v86detail11to_unsignedIiEENSt13make_unsignedIT_E4typeES4_[_ZN3fmt2v86detail11to_unsignedIiEENSt13make_unsignedIT_E4typeES4_]+0x23): undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
The solution for successfull compilation is to also define the FMT_HEADER_ONLY macro.
#define FMT_HEADER_ONLY
#define FMTLOG_HEADER_ONLY
#include "fmtlog.h"
int main()
{
FMTLOG(fmtlog::INF, "The answer is {}.", 42);
}
giving 14:51:17.007652 source.cpp:8 INF[29545 ] The answer is 42. 🎉
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi 👋 ,
I just wanted to provide some feedback in case someone encounters an issue similar to mine when trying to compile with FMTLOG_HEADER_ONLY.
For reference, I installed fmtlib through
sudo apt install libfmt-dev
on Linux Mint 21.3.I tried to compile the following minimal example with
g++ -std=c++17 -o myprogram source.cpp
.which fails with a ton of errors like
The solution for successfull compilation is to also define the FMT_HEADER_ONLY macro.
giving
14:51:17.007652 source.cpp:8 INF[29545 ] The answer is 42.
🎉Beta Was this translation helpful? Give feedback.
All reactions