troldal / OpenXLSX

A C++ library for reading, writing, creating and modifying Microsoft Excel® (.xlsx) files.
BSD 3-Clause "New" or "Revised" License
1.34k stars 321 forks source link

The bug fix on MacOs is missing in branch master #278

Open gengxiandada opened 5 days ago

gengxiandada commented 5 days ago

https://github.com/troldal/OpenXLSX/blob/master/OpenXLSX/sources/XLDateTime.cpp The bug fix on MacOs is missing and should include "#include <string>" in the header

aral-matrix commented 3 days ago

I do not understand. XLDateTime.cpp does not use std::strings anywhere? How can this be a bug? Could you be more specific / maybe post a compiler error message?

gengxiandada commented 3 days ago

The parameter of the constructor of the class XLDateTimeError is type of "const std::string &", so there exists a conversion of "const char *" to "const std::string &". You can see in line 89, for example. The compiler throw the err

"error: no matching conversion for functional-style cast from 'const char[59]' to 'XLDateTimeError' if (serial < 1.0) throw XLDateTimeError("Excel date/time serial number is invalid (must be >= 1.0.)")".

So if there is no #include the compiler can not identify this, at least on MacOS. I saw that the repository author fixed this bug earlier, but now it's gone.

aral-matrix commented 3 days ago

Understood - thank you for reporting this. The actual missing include was in XLException.hpp - please have a look at commit 58950bebdcefccb45d553a8d83661d33b9e0778b - this should address the follow-up error you are seeing.