Compilation error with MSVC 19

Thibaut Cuvelier tcuvelier at lyx.org
Wed Dec 30 00:04:32 UTC 2020


On Wed, 30 Dec 2020 at 00:52, Thibaut Cuvelier <tcuvelier at lyx.org> wrote:

> On Tue, 29 Dec 2020 at 23:50, Yuriy Skalko <yuriy.skalko at gmail.com> wrote:
>
>> > I just tried to recompile LyX on MSVC 19, this is the error I get:
>> >
>> >
>> > [ 40%] Building CXX object
>> > src/frontends/qt/CMakeFiles/frontend_qt.dir/GuiApplication.cpp.obj
>> > GuiApplication.cpp
>> > D:\LyX\lyx-unstable\3rdparty\nod\nod.hpp(272): error C2653:
>> 'result_of': is
>> > not a class or namespace name
>> > D:\LyX\lyx-unstable\3rdparty\nod\nod.hpp(323): note: see reference to
>> class
>> > template instantiation 'nod::signal_accumulator<S,T,F,A...>' being
>> compiled
>> > D:\LyX\lyx-unstable\3rdparty\nod\nod.hpp(272): error C2146: syntax
>> error:
>> > missing ';' before identifier 'type'
>> > D:\LyX\lyx-unstable\3rdparty\nod\nod.hpp(272): error C4430: missing type
>> > specifier - int assumed. Note: C++ does not support default-int
>> >
>> > It looks like it's due to bda45704005d6b328e18457a07d05e56883c2874, with
>> > the replacement of boost::signals2 (a heavy library) by nod (an
>> > unmaintained library). It's about things that are getting deleted in the
>> > latest versions of C++, meaning that it will probably bite other
>> compilers
>> > at some point in the future.
>> >
>> > As the author of the library did not answer to PRs in the last two
>> years,
>> > I'm not sure it's possible to upstream changes to it… What would be
>> best in
>> > this case?
>>
>> I assume that you are compiling LyX in C++20 mode since `result_of` is
>> only deprecated in C++17. Does the attached patch resolves this issue?
>> (It is strange, but seems like result_of still exists in C++20 mode of
>> GCC...)
>>
>> The nod library is pretty small and I suppose the only maintenance will
>> be due to backward incompatibilities of newer C++ standards.
>>
>
> I did not specify anything in particular, I let CMake deal with the
> details, actually. Forcing the C++20 mode did not work, with a
> set(CMAKE_CXX_STANDARD 20) in the CMakeFile.
>
> Unfortunately, your patch did not work, neither the corresponding code
> from Abseil (
> https://github.com/abseil/abseil-cpp/commit/e19260fd7dbef881492fd73891e0be5bd4a09b95
> ).
>
> Based on https://github.com/ReactiveX/RxCpp/issues/530, I tried with the
> _HAS_CXX17 macro, and it worked. I'm attaching the relevant patch, but I'm
> not sure it will work on other compilers.
>

Here is a newer version of the patch that does not use _HAS_CXX17, as it
should not really be relied upon (
https://stackoverflow.com/questions/52379233/is-has-cxx17-marco-usable-in-custom-project-headers-to-enable-c17-language).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201230/586afab8/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msvc.patch
Type: application/octet-stream
Size: 660 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201230/586afab8/attachment-0001.obj>


More information about the lyx-devel mailing list