From b26fea4cf5b908bba03e026b358a1778559c1dc8 Mon Sep 17 00:00:00 2001 From: Minmin Gong Date: Mon, 14 Aug 2017 21:51:59 -0700 Subject: [PATCH] Fix compiling problems under VS2017.3. 1. WordIterator's operator== and operator!= must take const WordIterator& as parameter type. 2. OpenMP doesn't work with new two phase lookups. Need to disable twoPhase. --- CMakeLists.txt | 6 ++++++ code/X3DImporter.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 676a48385..690351e8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,6 +148,12 @@ find_package(OpenMP) if (OPENMP_FOUND) SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + + IF(MSVC) + IF(MSVC_VERSION GREATER 1910) + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:twoPhase-") + ENDIF() + ENDIF() endif() CONFIGURE_FILE( diff --git a/code/X3DImporter.cpp b/code/X3DImporter.cpp index 111773563..669f46f95 100644 --- a/code/X3DImporter.cpp +++ b/code/X3DImporter.cpp @@ -95,8 +95,8 @@ struct WordIterator: public std::iterator end_ = other.end_; return *this; } - bool operator==(WordIterator &other) const { return start_ == other.start_; } - bool operator!=(WordIterator &other) const { return start_ != other.start_; } + bool operator==(const WordIterator &other) const { return start_ == other.start_; } + bool operator!=(const WordIterator &other) const { return start_ != other.start_; } WordIterator &operator++() { start_ += strcspn(start_, whitespace); start_ += strspn(start_, whitespace);