tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.49k stars 418 forks source link

Version 1.3+ is not compatible with only C++11 #487

Closed kbentley closed 3 years ago

kbentley commented 4 years ago

I was trying to build the latest commit and I noticed that although I had specified XLNT_CXX_VERSION to be 11 in the CMakeLists.txt, I was getting compilation errors with gcc 4.8.2 - the first c++11 complete version of gcc. Compiling with gcc >= 6 solved the issue.

I would recommend checking the compiler version, or performing a more strict check of the compiler version available, if it appears that there's an option to use only c++11 features. As it stands, it looks as if a c++14 capable compiler is required to build versions >= 1.3

Just a FYI - gcc 4.8.2 is the default system compiler on Red Hat / CentOS 7.

tfussell commented 4 years ago

Thanks for bringing this up. I originally targeted C++11, then started using some C++14 features, and reverted back to C++11. I must have missed some C++14-only code. The solution is to:

tfussell commented 3 years ago

I found that we had some lines like auto begin { std::begin (str) }; which are only allowed in C++14. In C++11 these were interpreted as initializer_list. I changed them in the linked PR to normal assignment using equals and tested that it builds in GCC 4.8.2 (with a few other small changes). I don't see an easy way to set up CI checks for this, but I'll be sure to keep an eye out for future code changes that won't work in C++11.