【发布时间】:2017-02-07 19:12:18
【问题描述】:
在为 Zynq 裸机 (Cross compile GNU Scientific Library for ARM Zynq ( baremetal )) 交叉编译 GNU Scientific 库失败后,我尝试改用 Eigen C++。
所以我下载它然后解压缩并包含它的标题,如下所示
-I/home/wizard/Desktop/eigen
代码在我的 PC(即 x64 Ubuntu)上运行良好,但只要我将编译器从 gcc 更改为 arm-xilinx-eabi-gcc 和 g++ 更改为 arm-xilinx-eabi-g++,代码就会给我以下信息错误:
invalid conversion from 'const int*' to 'const int32_t* {aka const long int*}' [-fpermissive] test4 line 244, external location: /home/wizard/Desktop/eigen/Eigen/src/Core/arch/NEON/PacketMath.h C/C++ Problem
invalid conversion from 'const int*' to 'const int32_t* {aka const long int*}' [-fpermissive] test4 line 247, external location: /home/wizard/Desktop/eigen/Eigen/src/Core/arch/NEON/PacketMath.h C/C++ Problem
invalid conversion from 'const int*' to 'const int32_t* {aka const long int*}' [-fpermissive] test4 line 259, external location: /home/wizard/Desktop/eigen/Eigen/src/Core/arch/NEON/PacketMath.h C/C++ Problem
invalid conversion from 'const int*' to 'const int32_t* {aka const long int*}' [-fpermissive] test4 line 260, external location: /home/wizard/Desktop/eigen/Eigen/src/Core/arch/NEON/PacketMath.h C/C++ Problem
invalid conversion from 'int*' to 'int32_t* {aka long int*}' [-fpermissive] test4 line 265, external location: /home/wizard/Desktop/eigen/Eigen/src/Core/arch/NEON/PacketMath.h C/C++ Problem
invalid conversion from 'int*' to 'int32_t* {aka long int*}' [-fpermissive] test4 line 268, external location: /home/wizard/Desktop/eigen/Eigen/src/Core/arch/NEON/PacketMath.h C/C++ Problem
invalid conversion from 'int*' to 'int32_t* {aka long int*}' [-fpermissive] test4 line 309, external location: /home/wizard/Desktop/eigen/Eigen/src/Core/arch/NEON/PacketMath.h C/C++ Problem
我该怎么办?
【问题讨论】:
-
嗯,它可能是一个 C 库,所以使用
gcc而不是g++将其编译为 C 代码。如果你需要在你的 C++ 代码中使用它,那么编译它,像往常一样链接它,并用extern "C"idiom 包含它。 -
@tambre 我可能没明白你的意思,但“Eigen”是一个 C++ 模板库。另外我尝试用 gcc 编译它但没有用:(
-
嗯,我不知道为什么,但 Eigen 的第 2 版就像一个魅力!!!