missing #includes complaints by MSVC 2017

Yuriy Skalko yuriy.skalko at gmail.com
Sat Oct 24 08:10:47 UTC 2020


> Dear LyX developers,
> 
> I just tried to compile LyX (commit
> 2c1753a5265c59ebd11fc465cdb119ff589ad965) on windows 10 with MSVC 2017
> toolkit, and encountered compiling errors of the sort:
> 
> 
>    src\DocIterator.h(335): error C2039: 'min': is not a member of 'std

Pavel, please check da8b5de97. Should <algorithm> be moved back from 
.cpp files?

In GCC `min` is defined via including <vector>.


> and another one about std::isspace.

As I understand, lyx::isSpace should be used instead in these 2 places. 
I've corrected this in attached patch.

Yuriy
-------------- next part --------------
From 81b63f86d0d982b965ab43c3f279ebfc149b20a6 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sat, 24 Oct 2020 11:03:36 +0300
Subject: [PATCH] Fix isSpace for docstring

---
 src/insets/InsetBibtex.cpp | 2 +-
 src/xml.cpp                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index bee485eeb6..f606444ede 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -1276,7 +1276,7 @@ void InsetBibtex::docbook(XMLStream & xs, OutputParams const &) const
 				xs << xml::StartTag("keywordset") << xml::CR();
 				for (auto & kw: keywords) {
 					kw.erase(kw.begin(), std::find_if(kw.begin(), kw.end(),
-					                                  [](int c) {return !std::isspace(c);}));
+					                                  [](char_type c) {return !lyx::isSpace(c);}));
 					xs << xml::StartTag("keyword");
 					xs << kw;
 					xs << xml::EndTag("keyword");
diff --git a/src/xml.cpp b/src/xml.cpp
index e50e55972b..aece3a4d01 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -144,7 +144,7 @@ docstring CompTag::writeTag() const
 		// automatically.
 		docstring attributes = escapeString(attr_, XMLStream::ESCAPE_NONE);
 		attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
-                                                          [](int c) {return !std::isspace(c);}));
+                                                          [](char_type c) {return !isSpace(c);}));
 		if (!attributes.empty()) {
 			output += ' ' + attributes;
 		}
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list