COMBINE-lab / maximum-likelihood-relatedness-estimation

22 stars 3 forks source link

fix compilation errors on modern g++/c++ compiler (Ubuntu 20) #22

Open didillysquat opened 3 years ago

didillysquat commented 3 years ago

These changes fix the compilation errors that occur on running make (e.g. #19) using new compilers such as those found on Ubuntu 20.

I successfully compiled with: g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0.

I also tried to compile with clang version 10.0.0-4ubuntu1 but this gave me a linker error.

At least with g++/c++ users should be able to get lcmlkin to compile.

brentp commented 3 years ago

These changes fix compilation for me. It's actually possible to just remove the definition of CHAR_WIDTH as it's #defined elsewhere. Here is the minimal diff for me to be able to build:

diff --git a/include/spdlog/details/format.cc b/include/spdlog/details/format.cc
index dde4aa5..0417092 100644
--- a/include/spdlog/details/format.cc
+++ b/include/spdlog/details/format.cc
@@ -480,7 +480,6 @@ public:
         typedef typename BasicWriter<Char>::CharPtr CharPtr;
         Char fill = internal::CharTraits<Char>::cast(spec_.fill());
         CharPtr out = CharPtr();
-        const unsigned CHAR_WIDTH = 1;
         if (spec_.width_ > CHAR_WIDTH) {
             out = writer_.grow_buffer(spec_.width_);
             if (spec_.align_ == ALIGN_RIGHT) {
@@ -1419,4 +1418,4 @@ template int fmt::internal::CharTraits<wchar_t>::format_float(

 #ifdef _MSC_VER
 # pragma warning(pop)
-#endif
\ No newline at end of file
+#endif
diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h
index cd5b6b0..c4b7905 100644
--- a/include/spdlog/spdlog.h
+++ b/include/spdlog/spdlog.h
@@ -11,6 +11,7 @@
 #include "tweakme.h"
 #include "common.h"
 #include "logger.h"
+#include <functional>

 namespace spdlog
 {