Skip to content

Changes to compile successfully on windows with VS2019 and CMake 3.28 #21

Description

@paul-caswell

cbor-cpp.patch

 CMakeLists.txt         | 2 +-
 src/listener_debug.cpp | 8 ++++++++
 src/listener_debug.h   | 4 ++++
 src/log.h              | 4 ++--
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d50f799..27559f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 2.8)
 project(cborcpp)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_BUILD_TYPE Release)
 
 set(SOURCE_FILES
diff --git a/src/listener_debug.cpp b/src/listener_debug.cpp
index 5b79b74..a4799f7 100644
--- a/src/listener_debug.cpp
+++ b/src/listener_debug.cpp
@@ -22,6 +22,14 @@ void listener_debug::on_integer(int value) {
     printf("integer: %d\n", value);
 }
 
+void listener_debug::on_float32(float value) {
+    printf("float: %f\n", value);
+}
+
+void listener_debug::on_double(double value) {
+    printf("double: %f\n", value);
+}
+
 void listener_debug::on_bytes(unsigned char *data, int size) {
     printf("bytes with size: %d", size);
 }
diff --git a/src/listener_debug.h b/src/listener_debug.h
index b7d2b17..bd74626 100644
--- a/src/listener_debug.h
+++ b/src/listener_debug.h
@@ -26,6 +26,10 @@ namespace cbor {
     public:
         virtual void on_integer(int value);
 
+        virtual void on_float32(float value);
+
+        virtual void on_double(double value);
+
         virtual void on_bytes(unsigned char *data, int size);
 
         virtual void on_string(std::string &str);
diff --git a/src/log.h b/src/log.h
index 5f651df..4d4b8f0 100644
--- a/src/log.h
+++ b/src/log.h
@@ -19,8 +19,8 @@
 
 #include <stdio.h>
 
-#define logger(line) fprintf(stderr, "%s:%d [%s]: %s\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, line)
-#define loggerf(format, ...) fprintf(stderr, "%s:%d [%s]: " format "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
+#define logger(line) fprintf(stderr, "%s:%d [%s]: %s\n", __FILE__, __LINE__, __FUNCTION__, line)
+#define loggerf(format, ...) fprintf(stderr, "%s:%d [%s]: " format "\n", __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
 
 #endif


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions