c++ - fatal error C1083 : Cannot open include file: 'complex.h' : No such file or directory . .\lapacke\include\lapacke.h

标签 c++ visual-studio-2008 fatal-error lapack lapacke

我基于以下链接为我的 Visual Studio 2008 构建了 LAPACKE 的 DLL 和库:

http://icl.cs.utk.edu/lapack-for-windows/lapack/

构建LAPACKE后,我进行了如下测试,并通过了测试:

enter image description here

构建后,我有以下可用文件:

enter image description here enter image description here enter image description here enter image description here

我在 Visual Studio 2008 中使用了以下技巧:

enter image description here

现在我有以下 Visual Studio 2008 项目:

enter image description here

我的项目中有以下 C++ 代码:

enter image description here enter image description here enter image description here

当我注释掉 #include "lapacke.h" 行时可执行文件构建,我得到以下控制台输出:

enter image description here

然而,当我不注释掉#include "lapacke.h"时我收到以下错误:

enter image description here

错误位置是lapacke.h的第73行如下所示:

enter image description here

感谢任何帮助。


编辑:

即使在包含 #include <cstdlib> 之后之前 #include "lapacke.h" ,同样的错误发生:

enter image description here


编辑:

在以下链接中,一些人讨论了一个看起来相关的问题:

http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=2284

http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=4221


编辑

在文件中lapacke.h以下语句可用于复杂类型。

/* 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>"
*/

#ifndef LAPACK_COMPLEX_CUSTOM

/* Complex type (single precision) */
#ifndef lapack_complex_float
#include <complex.h>
#define lapack_complex_float    float _Complex
#endif

#ifndef lapack_complex_float_real
#define lapack_complex_float_real(z)       (creal(z))
#endif

#ifndef lapack_complex_float_imag
#define lapack_complex_float_imag(z)       (cimag(z))
#endif

lapack_complex_float lapack_make_complex_float( float re, float im );

/* Complex type (double precision) */
#ifndef lapack_complex_double
#include <complex.h>
#define lapack_complex_double   double _Complex
#endif

#ifndef lapack_complex_double_real
#define lapack_complex_double_real(z)      (creal(z))
#endif

#ifndef lapack_complex_double_imag
#define lapack_complex_double_imag(z)       (cimag(z))
#endif

lapack_complex_double lapack_make_complex_double( double re, double im );

#endif

我修改了头文件如下:

enter image description here

但是我收到以下错误:

enter image description here

以上错误发生在以下位置:

enter image description here

我不确定如何解决此错误。


编辑:

最后加上#include <complex>解决了问题如下所示。顺便说一句,这篇文章帮助我弄明白了:MinGW error: 'min' is not a member of 'std'

enter image description here

重建没有任何问题:

enter image description here

最佳答案

Lapacke是C代码,不是C++。 Visual C++ 对 C 的支持有限,不支持 _Complex .在 C++ 中,您将使用 std::complex<float> .

定义 LAPACK_COMPLEX_CUSTOM可以跳过使用 _Complex ,根据您显示的代码。

附言。请在您的问题中包含源代码,而不是图像。

关于c++ - fatal error C1083 : Cannot open include file: 'complex.h' : No such file or directory . .\lapacke\include\lapacke.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26933589/

相关文章:

c++ - 淘汰vscode中未使用的变量

c++ - QT Creator 中的错误 LNK1117

c# - 打开不属于项目的 cs 文件时,有什么方法可以使 Intellisense 工作?

php - 需要帮助解决 Elasticsearch 中的 fatal error 异常

c++ - Qt - webkit - 如何从网页中提取图像

c++ - 显式链接 DLL 和类方法

c# - “GenerateResource”任务意外失败-尝试读取或写入 protected 内存。这通常表明其他内存已损坏

c++ - Visual Studio 2008 开始调试更改关联的可执行文件

swift - 刷新时出现 fatal error : Array index out of range. Swift

php - 未捕获的异常 'Google_Service_Exception',显示消息“调用PUT时出错