[BUG] GuiView::zoom_max_ and GuiView::zoom_min_ are missing definitions
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Mon Jan 22 16:34:10 UTC 2024
Le 08/01/2024 à 18:36, Richard Kimberly Heck a écrit :
> 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.
Actually, this has already been backported last January. I am not sure
what to do right now.
JMarc
More information about the lyx-devel
mailing list