【问题标题】:C++ SSE3 instruction set not enabled未启用 C++ SSE3 指令集
【发布时间】:2013-01-31 09:06:10
【问题描述】:

我正在尝试使用来自

的 HMMlib 库在 c++ 中处理一些隐藏的马尔可夫代码
http://www.cs.au.dk/~asand/?page_id=152

我使用的是 ubuntu 12.04,带有 gcc / g++ 4.6

我的编译步骤指令是:

g++ -I/usr/local/boost_1_52_0 -I../ MAIN.cpp

这会产生以下错误:

In file included from ../HMMlib/allocator_traits.hpp:25:0,
             from ../HMMlib/hmm_table.hpp:25,
             from MAIN.cpp:1:
/usr/lib/gcc/i686-linux-gnu/4.6/include/pmmintrin.h:32:3: error: #error "SSE3      instruction set not enabled"
In file included from ../HMMlib/hmm_table.hpp:25:0,
             from MAIN.cpp:1:
../HMMlib/allocator_traits.hpp:50:33: error: ‘__m128d’ was not declared in this scope
../HMMlib/allocator_traits.hpp:50:40: error: template argument 2 is invalid
../HMMlib/allocator_traits.hpp:77:32: error: ‘__m128’ was not declared in this scope
../HMMlib/allocator_traits.hpp:77:38: error: template argument 2 is invalid
In file included from ../HMMlib/hmm_table.hpp:26:0,
             from MAIN.cpp:1:
../HMMlib/operator_traits.hpp:112:32: error: ‘__m128d’ was not declared in this scope
../HMMlib/operator_traits.hpp:112:39: error: template argument 2 is invalid
../HMMlib/operator_traits.hpp:205:31: error: ‘__m128’ was not declared in this scope
../HMMlib/operator_traits.hpp:205:37: error: template argument 2 is invalid
In file included from ../HMMlib/hmm_table.hpp:27:0,
             from MAIN.cpp:1:
../HMMlib/float_traits.hpp:37:13: error: ‘__m128’ does not name a type
../HMMlib/float_traits.hpp:43:13: error: ‘__m128d’ does not name a type
In file included from ../HMMlib/hmm.hpp:34:0,
             from MAIN.cpp:3:
../HMMlib/sse_operator_traits.hpp:63:35: error: ‘__m128’ was not declared in this scope
../HMMlib/sse_operator_traits.hpp:63:41: error: template argument 2 is invalid
../HMMlib/sse_operator_traits.hpp:95:36: error: ‘__m128d’ was not declared in this scope
../HMMlib/sse_operator_traits.hpp:95:43: error: template argument 2 is invalid

我完全不知道这些错误是什么意思,以及如何解决它们

【问题讨论】:

  • 添加-march=native为你自己的cpu编译,或者从man gcc中选择合适的-march选项(应该是支持SSE3的CPU)。

标签: c++ compiler-errors sse3


【解决方案1】:

您必须使用命令行选项启用 gcc 的 sse3 内在函数。尝试编译

g++ -msse3 -I/usr/local/boost_1_52_0 -I../ MAIN.cpp

或通过处理器选择指令集

g++ -march=core2 -I/usr/local/boost_1_52_0 -I../ MAIN.cpp

回复您的评论:-march=native 选择您当前正在运行的处理器的指令集。

注意-msse3已经选择了它的子集-msse2-msse

【讨论】:

  • @AdityaSihag 这是您应该复制和粘贴的创造性思维。看这里:-msse3.
猜你喜欢
  • 2011-02-16
  • 1970-01-01
  • 2012-02-27
  • 1970-01-01
  • 2011-09-01
  • 2021-08-10
  • 2013-04-30
  • 2012-04-28
  • 2014-08-06
相关资源
最近更新 更多