c++ FFTW3链接错误

C++ FFTW3 linking error

本文关键字:错误 链接 FFTW3 c++      更新时间:2023-10-16

每当我试图用FFTW3实现编译c++程序时,我都会得到非常奇怪的错误。

我正在编译如下

g++ - 03 -lfftw3 myFile.cpp -o myFileFFTW

我还包括我的头文件如下

#include <math.h> #include "fftw3.h"

错误如下

(.text+0x63):对fftw_malloc的未定义引用

有什么建议吗?

编辑:

HMJD的建议对我有用。编译glib时链接器错误…?

我想一个人不应该连续工作3天,否则头脑不工作!!特别感谢hmjd!!你拯救了我的一天,我可以按时完成我的项目!!

我猜问题是-lfftw3不存在于您的系统,您也没有正确指定库。

编译器命令末尾的库:

gcc -I/usr/lib/x86_64-linux-gnu/lib-2.0/include re.c -o re -lglib-2.0

From GCC Link Options:

-llibrary- l图书馆链接时搜索名为library的库。(第二种选择是将库作为单独的参数仅用于POSIX兼容,不推荐使用。)

It makes a difference where in the command you write this option;
the linker searches and processes libraries and object files in the
order they are specified.
Thus, `foo.o -lz bar.o' searches library `z' after file foo.o but
before bar.o. If bar.o refers to functions in `z', those functions
may not be loaded.

编译时链接器错误的片段…?

相关文章: