On 1/8/24 05:03, Jean-Marc Lasgouttes wrote:
Le 08/01/2024 à 10:52, Yexuan Xiao a écrit :
I tried to use cmake to compile lyx, but failed because there are errors in lyx's code. Refer to https://en.cppreference.com/w/cpp/language/static, if a const static data member or a constexpr static data member is odr-used, a definition at namespace scope is still required. In the file src/frontends/qt4/GuiView.h line 482, zoom_max_ and zoom_min_ are declared, but not defined. And in GuiView.cpp line 784, 4241, there is the following code: zoom = min(max(zoom, zoom_min_), zoom_max_);. Because std::min and std::max take parameters as const T&, not T, zoom_max_ and zoom_min_ are odr-used, and thus require their definitions. The fix is simple, in C++17 mode, declare and define zoom_max_ and zoom_min_ as "constexpr", such as "static constexpr zoom_max_ = 100;" in the class definition, or in C++11 mode, provide their definitions in GuiView.cpp, such as "int const GuiView::zoom_max_;".



Hello,

Thanks for the thorough bug report. This 2.3.x issue seems to have been fixed in master at cd995a2b. Riki, can I backport?

Yes, of course.

Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to