#error “SSE2 instruction set not enabled” when including

后端 未结 1 464
一向
一向 2021-02-10 14:12

I´m trying to compile some C++ code with cmake and make that uses the include and get the following make error:

 #error \"SSE2          


        
相关标签:
1条回答
  • 2021-02-10 14:50

    You need to call

    set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-msse -msse2 -msse3")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3")

    The CMAKE_C_FLAGS are applied to C files, and from your post's C++ tag, I guess you're compiling C++ files, hence the need to change CMAKE_CXX_FLAGS instead.

    As for the positioning of the quotation marks; in your original version, you were setting CMAKE_C_FLAGS to contain 2 separate entries, the first being the starting value of CMAKE_C_FLAGS and the second being the string "-msse -msse2 -msse3".

    CMake holds lists like this as semi-colon separated entries. In the case of CMAKE_<lang>_FLAGS, invariably they are a single value comprised of a string containing all the required flags.

    0 讨论(0)
提交回复
热议问题