请帮我!我在网上查了好几个小时还是没有找到解决办法......
我正在尝试使用 call lapack 函数C++
功能,但我一开始就失败了。这是我的代码:
#include "stdafx.h"
#include "targetver.h"
extern "C" {
#include "lapacke.h"
}
int main{}
{
return 0;
}
我知道“lapacke.h”是一个 C 头文件,所以我使用extern "C"
条款。但是当我尝试编译这个简单的函数时,出现以下错误:
Error 1 error C2146: syntax error : missing ';' before identifier 'lapack_make_complex_float' c:\users\svd_example1\example2\example2\lapacke.h 89 1 example2
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\svd_example1\example2\example2\lapacke.h 89 1 example2
有谁知道导致这些错误的原因是什么?
非常感谢!
标头的相关部分是:
/* Complex types are structures equivalent to the
* Fortran complex types COMPLEX(4) and COMPLEX(8).
*
* One can also redefine the types with his own types
* for example by including in the code definitions like
*
* #define lapack_complex_float std::complex<float>
* #define lapack_complex_double std::complex<double>
*
* or define these types in the command line:
*
* -Dlapack_complex_float="std::complex<float>"
* -Dlapack_complex_double="std::complex<double>"
*/
/* Complex type (single precision) */
#ifndef lapack_complex_float
#include <complex.h>
#define lapack_complex_float float _Complex
#endif
/* ... */
lapack_complex_float lapack_make_complex_float( float re, float im );
这里使用C99_Complex
默认情况下,Visual C++ 不支持。您可以按照建议使用定义这些宏std::complex
相反,Visual C++ 支持:
#include <complex>
#define lapack_complex_float std::complex<float>
#define lapack_complex_double std::complex<double>
#include "lapacke.h"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)