I am trying to use MinGW to compile Linux project into Windows. I have been successful doing so with Cygwin, but I would match rather prefer to use MinGW so I the program does not end up having dozens of unnecessary dependencies.
我正在尝试使用MinGW将Linux项目编译到Windows中。我已经成功地使用Cygwin,但是我会匹配而不是更喜欢使用MinGW,所以我的程序最终没有几十个不必要的依赖。
Unfortunately, I have run into a problem that the compiler complains of unidentified references to the file. I am using a precompiled version of FFTW3 for Windows and using dlltool to create .a files to link it to MinGW. I have specified the libpath for the compiler, but unfortunately, I am still encountering errors.
不幸的是,我遇到了一个问题,即编译器抱怨对文件的未识别引用。我正在使用预编译版本的FFTW3 for Windows,并使用dlltool创建.a文件以将其链接到MinGW。我已经为编译器指定了libpath,但不幸的是,我仍然遇到错误。
Here is my output:
这是我的输出:
make all
gcc -I../Include -L..\Lib -Wall -O3 -o lvdoenc lvdoenc.o lvdomain.o -I../Include -L..\Lib -m32
lvdoenc.o:lvdoenc.c:(.text+0x29b): undefined reference to _imp__fftw_execute' lvdoenc.o:lvdoenc.c:(.text+0x608): undefined reference to
_imp__fftw_malloc'
lvdoenc.o:lvdoenc.c:(.text+0x647): undefined reference to _imp__fftw_plan_r2r_2d' lvdoenc.o:lvdoenc.c:(.text+0x8d1): undefined reference to
_imp__fftw_free'
lvdoenc.o:lvdoenc.c:(.text+0x8e5): undefined reference to _imp__fftw_destroy_plan' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: lvdoenc.o: bad reloc address 0x20 in section
.eh_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
make: *** [lvdoenc] Error 1
13:23:28 Build Finished (took 217ms)
13:23:28构建完成(耗时217ms)
All the solutions I have come across involve compiling using gcc to link fftw3 (-lfftw3), but this does not work in MinGW. I am having the same problem in the Cygwin, but that solution of using -lfftw3 as a compiler option does work. I have even specified the location of the lib path. The include path works just fine, but it can't find the library in the libpath.
我遇到的所有解决方案都涉及使用gcc编译链接fftw3(-lfftw3),但这在MinGW中不起作用。我在Cygwin中遇到了同样的问题,但使用-lfftw3作为编译器选项的解决方案确实有效。我甚至指定了lib路径的位置。 include路径工作正常,但它无法在libpath中找到库。
Any help would be great appreciated.
任何帮助将非常感谢。
1 个解决方案
#1
2
I downloaded the DLLs from here.
我从这里下载了DLL。
Then I've done the following (see http://www.mingw.org/wiki/createimportlibraries):
然后我做了以下(见http://www.mingw.org/wiki/createimportlibraries):
dlltool -d libfftw3-3.def -l libfftw3.a
dlltool -d libfftw3-3.def -l libfftw3.a
/* x.c */
int main() { fftw_malloc(); }
gcc x.c -L.\. -lfftw3
gcc x.c -L。\。 -lfftw3
#1
2
I downloaded the DLLs from here.
我从这里下载了DLL。
Then I've done the following (see http://www.mingw.org/wiki/createimportlibraries):
然后我做了以下(见http://www.mingw.org/wiki/createimportlibraries):
dlltool -d libfftw3-3.def -l libfftw3.a
dlltool -d libfftw3-3.def -l libfftw3.a
/* x.c */
int main() { fftw_malloc(); }
gcc x.c -L.\. -lfftw3
gcc x.c -L。\。 -lfftw3