简体   繁体   English

使用gcc编译文件时链接fftw-3.3.6-pl2

[英]Linking fftw-3.3.6-pl2 while compiling my file using gcc

I'm trying to run a simple code that includes the fftw library. 我正在尝试运行包含fftw库的简单代码。 I know the code is right as it is provided as a test code by the authors. 我知道该代码是正确的,因为作者将其作为测试代码提供。 This is what I typed during compilation: 这是我在编译期间输入的内容:

gcc my file.c  -L/home/ankit/Desktop/fftw-3.3.6-pl2/lib/ 
-I/home/ankit/Desktop/fftw-3.3.6-pl2/include/  -lfftw  -lm

I get the errors: 我得到了错误:

myfile.c: (.Text+0x2c):. myfile.c:(.Text + 0x2c): undefined reference to 'fftw_plan_dft_2d' collect2: ld returned 1 exit status 未定义对'fftw_plan_dft_2d'的引用collect2:ld返回1退出状态

It wasn't a linking problem, installation was faulty and I had to use 'sudo make install' to get the permission for the installation to be successful. 这不是链接问题,安装有问题,我必须使用'sudo make install'来获得安装成功的许可。 I could link it with 'gcc test.c -lfftw3 -lm' after. 之后,我可以将其与“ gcc test.c -lfftw3 -lm”链接。 Thanks for your suggestions! 感谢您的建议!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM