SSE g++ 编译问题
SSE g++ compilation issue
我正在尝试使用SSE内部函数。 我制作了一个测试程序,它只是将两个向量与四个 16 位元素一起添加。
#include <xmmintrin.h>
#include <iostream>
using namespace std;
void test_vec_add(){
const int length = 4;
float product[128*4] __attribute__ ((aligned(16)));
_m128 x = _mm_set_ps(1.0f,2.0f,3.0f,4.0f);
_m128 y = _mm_set_ps(1.0f,2.0f,3.0f,4.0f);
_m128 z = _mm_add_ps(x,y);
_mm_store_ps(product,z);
}
int main(){
test_vec_add();
}
我正在编译此代码
g++ -msse3 test_sse.cpp
但是,我收到以下并发症错误
test_sse.cpp: In function ‘void test_vec_add()’:
test_sse.cpp:7:3: error: ‘_m128’ was not declared in this scope
test_sse.cpp:7:9: error: expected ‘;’ before ‘x’
test_sse.cpp:8:9: error: expected ‘;’ before ‘y’
test_sse.cpp:9:9: error: expected ‘;’ before ‘z’
test_sse.cpp:10:24: error: ‘z’ was not declared in this scope
test_sse.cpp: In function ‘int main()’:
test_sse.cpp:15:20: error: ‘test_vec_add’ was not declared in this scope
这可能是一个非常愚蠢的错误,但我无法确定它在哪里。 任何帮助将不胜感激。
这是一个
简单的错字。
__m128
等类型以两个下划线开头。诸如_mm_store_ps
之类的函数仅以一个下划线开头。
相关文章:
- 编译包含字符串的代码时遇到问题
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- 编译要在英特尔Hyperscan中使用的.cc文件时出现问题
- 如何在 Mac 上正确编译C++,当它在 Linux 上编译没有问题时?
- Rextester 语言编译C++问题
- 这是使用回溯的 nqueen 问题,但我使用了动态 2d 数组,我的程序编译良好,但不返回任何输出
- 编译 llvm 插件时出现问题:llvm/Config/llvm-config.h:没有这样的文件或目录
- C++ 多级虚拟继承编译问题
- 编译问题:在函数"_start"中:未定义对"主"的引用 collect2:错误:ld 返回 1 个退出状态
- 在Linux上使用Clang / OLLVM交叉编译helloworld Windows可执行文件时的问题
- 使用 CImg 库的 std::min 和 std::max 的编译问题
- Qt Visual Studio 2015 加载项编译问题
- 构造函数和 G++ 编译配方的问题
- 解析问题 - 预期的非限定 ID - #include <array> 编译错误
- libssh 问题编译问题未定义的错误
- Eclipse 问题 - 编译期间不考虑 .c 和 .cpp 文件中定义的预处理
- Visual Studio 2017问题编译了C 代码,而该代码则在Linux中编译
- 这个C++代码有什么问题?编译错误:调用“测试::测试(测试)”没有匹配函数
- 试图编译基本Boost PropertyTree示例时出现问题-编译错误.该怎么做
- 如何解决***缺少分隔符的问题.编译QT(或支持库)时