Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complie Error #3

Closed
hongshenggeng opened this issue Mar 1, 2022 · 4 comments · Fixed by #7
Closed

Complie Error #3

hongshenggeng opened this issue Mar 1, 2022 · 4 comments · Fixed by #7

Comments

@hongshenggeng
Copy link

Dear Dep: I have cloned the pillow-resize and complied it. But met some Error as followed:
the first one is "error: ‘_clip8_lut’ declared as an ‘inline’ field",
the second is "‘static constexpr auto PillowResize::_lut(Generator&&) [with long unsigned int Length = 1280ul; Generator = PillowResize::<lambda(size_t)>]’ called in a constant expression
_lut([](size_t n) -> uchar {".
Could you help me to solve them?

Thanks.

@marcov868
Copy link
Contributor

Can you share some details about your platform (e.g. compiler, OS, OpenCV version), please?

@bnascimento
Copy link

Bumped into same issue.
Tried to use the lib with the following line:
cv::Mat resized = PillowResize::resize(src, cv::Size(INPUT_W, INPUT_H), cv::INTER_LINEAR);

and it gave me the following error:
/usr/local/include/PillowResize/PillowResize.hpp: In instantiation of ‘constexpr const std::array<unsigned char, 1280> PillowResize::_clip8_lut<1280, -640>’: /usr/local/include/PillowResize/PillowResize.hpp:170:39: required from here /usr/local/include/PillowResize/PillowResize.hpp:147:34: error: temporary of non-literal type ‘PillowResize::<lambda(size_t)>’ in a constant expression 147 | static inline constexpr auto _clip8_lut = | ^~~~~~~~~~ /usr/local/include/PillowResize/PillowResize.hpp:148:22: note: ‘PillowResize::<lambda(size_t)>’ is not literal because: 148 | _lut<Length>([](size_t n) -> uchar { | ^~~~~~~~~~~~~~~~~~~~~~~ 149 | intmax_t saturate_val = static_cast<intmax_t>(n) + min_val; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | if (saturate_val < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~ 151 | return 0; | ~~~~~~~~~ 152 | } | ~ 153 | if (saturate_val > UCHAR_MAX) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | return UCHAR_MAX; | ~~~~~~~~~~~~~~~~~ 155 | } | ~ 156 | return static_cast<uchar>(saturate_val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 157 | }); | ~ cc1plus: note: ‘PillowResize::<lambda(size_t)>’ is a closure type, which is only literal in C++17 and later /home/bnascimento/development/evotegra/data_processing/apps/DeepHawkeye/cpp/src/main.cpp: In function ‘int main(int, char**)’:

@bnascimento
Copy link

Building the project with set(CMAKE_CXX_STANDARD 17) worked.

@marcov868
Copy link
Contributor

I added a different version of that function that can be compiled using either c++17 or the previous versions. Tell me if you still have problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants