首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CBLAS_ORDER不是gcc的类或名称空间,而是在VS2010 (Intel C++)中编译得很好。

CBLAS_ORDER不是gcc的类或名称空间,而是在VS2010 (Intel C++)中编译得很好。
EN

Stack Overflow用户
提问于 2013-07-25 09:02:30
回答 1查看 469关注 0票数 0

我是C++的新手(我主要有C#背景)。我已经收到了一些从Windows移植到Linux的代码,但是虽然我可以让Visual 2010编译它(使用Intel C++编译器),但我无法让它在linux中使用gcc,或者使用Intel C++ Linux编译器(两者都给出了相同的错误)。我不认为这是一个英特尔的特定功能,不起作用,这就是为什么我在这里要求,而不是在英特尔论坛。

我试图编译的文件DoubleMatrixOperations.cpp是:

代码语言:javascript
复制
#include <ipp.h> 
#include <mkl.h> 

extern "C" 
{ 
void Multiply_mdvd_vd(int rows, int cols, double* vout, double* m, double* v, bool transpose) 
{ 
cblas_dgemv( 
CBLAS_ORDER::CblasRowMajor, 
transpose ? CBLAS_TRANSPOSE::CblasTrans : CBLAS_TRANSPOSE::CblasNoTrans, 
rows, cols, 1.0, m, cols, v, 1, 0.0, vout, 1); 
} 
}

编译器的输出是:

代码语言:javascript
复制
$ gcc DoubleMatrixOperations.cpp -I$IPPROOT/include
DoubleMatrixOperations.cpp: In function âvoid Multiply_mdvd_vd(int, int, double*, double*, double*, bool)â:
DoubleMatrixOperations.cpp:9:4: error: âCBLAS_ORDERâ is not a class or namespace
DoubleMatrixOperations.cpp:10:16: error: âCBLAS_TRANSPOSEâ is not a class or namespace
DoubleMatrixOperations.cpp:10:46: error: âCBLAS_TRANSPOSEâ is not a class or namespace

如果这是个愚蠢的问题,请提前道歉!

谢谢,托马斯

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-25 09:11:30

编辑:在评论部分正确地指出,当您使用C++11时不存在这个问题,但是下面的解决方案适用于旧的编译器。

因为CBLAS_ORDERCBLAS_TRANSPOSE是枚举,而不是类/名称空间,所以它们不引入作用域。这就是为什么您应该删除名称限定符:

代码语言:javascript
复制
cblas_dgemv(CblasRowMajor, transpose ? CblasTrans : CblasNoTrans, rows, cols, 1.0, m, cols, v, 1, 0.0, vout, 1);

但是,VC编译器应该编译这段代码,但是它也应该是print some warning

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17853501

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档