uzh-rpg / fast

FAST corner detector by Edward Rosten
GNU Lesser General Public License v2.1
113 stars 89 forks source link

Compile error on Ubuntu 22.04 #10

Open unicornuniform opened 1 year ago

unicornuniform commented 1 year ago

In file:src/faster_corner_10_sse.cpp

home/sam/lib/fast/src/faster_corner_10_sse.cpp: In function ‘void fast::faster_corner_detect_10(const fast_byte, int, int, int, short int, std::vector&)’: /home/sam/lib/fast/src/faster_corner_10_sse.cpp:22:30: error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register] 22 | register const __m128i barriers = _mm_set1_epi8((fast_byte)barrier); | ^~~~ /home/sam/lib/fast/src/faster_corner_10_sse.cpp: In instantiation of ‘void fast::faster_corner_detect_10(const fast_byte, int, int, int, short int, std::vector&) [with bool Aligned = true; fast::fast_byte = unsigned char]’: /home/sam/lib/fast/src/faster_corner_10_sse.cpp:199:40: required from here /home/sam/lib/fast/src/faster_corner_10_sse.cpp:22:30: error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register] /home/sam/lib/fast/src/faster_corner_10_sse.cpp: In instantiation of ‘void fast::faster_corner_detect_10(const fast_byte*, int, int, int, short int, std::vector&) [with bool Aligned = false; fast::fast_byte = unsigned char]’: /home/sam/lib/fast/src/faster_corner_10_sse.cpp:201:41: required from here /home/sam/lib/fast/src/faster_corner_10_sse.cpp:22:30: error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register]

Fixed by inserting:

// C++17 removed the register keyword, so we define it to nothing so that
// it doesn't cause errors.
#if __cplusplus >= 201703L
#define register
#endif