j123b567 / scpi-parser

Open Source SCPI device library
BSD 2-Clause "Simplified" License
447 stars 191 forks source link

Compile error when compiling with C++17 #143

Closed festlv closed 1 year ago

festlv commented 1 year ago

When compiling with C++17, the following error was encountered:

scpi-parser/libscpi/inc/scpi/cc.h:113:63: error: operator '||' has no right operand
  113 | #if (defined _ISOC99_SOURCE && _ISOC99_SOURCE) || C99 || CXX98
      |                                                               ^

which to me looks be caused by a typo in the definition of CXX98, which can be fixed with:

diff --git a/libscpi/inc/scpi/cc.h b/libscpi/inc/scpi/cc.h
index 2fc79c7..3487ed1 100644
--- a/libscpi/inc/scpi/cc.h
+++ b/libscpi/inc/scpi/cc.h
@@ -56,7 +56,7 @@ extern "C" {

 #if defined(__cplusplus)
 # if (__cplusplus >= 199711)
-#  define CXX98
+#  define CXX98 1
 # endif
 #endif
MisterHW commented 1 year ago

Good find. C99 is used in the same way and is #define C99 1.