问题描述
我试图用cmake编译一些C ++代码,并使用include< emmintrin.h>
并得到以下make错误: #error未启用SSE2指令集
我有一个带有Linux(Mint)系统(Kernel 3.5)的Intel Celeron双核处理器。
根据维基百科,Celeron Dual Core能够执行SSE2指令,并且sse2标志根据 / proc / cpuinfo
。但是,的作者提到了有限的SSE支持英特尔赛扬。
我已经尝试在 CMakeLists.txt
中使用SSE编译器选项:
set(CMAKE_C_FLAGS $ {CMAKE_C_FLAGS}-msse -msse2 -msse3)
..但没有改变。 cmake。
工作正常,但 make
给出上面的错误消息。
我必须更改CMakeLists.txt中的设置,或者Celeron Dual Core是否(完全)不支持SSE2?
您需要致电
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.
这篇关于#error“SSE2指令集未被使能”当包括< emmintrin.h>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!