gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:20:36 24 4
gpt4 key购买 nike

我基于以下链接为我的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com