DLL:使用MinGW在Linux上的Windows编译C时,文件格式无法识别 [英] DLL: File format not recognised when compiling C with MinGW on Linux for Windows

查看:551
本文介绍了DLL:使用MinGW在Linux上的Windows编译C时,文件格式无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MinGW的在Linux(Ubuntu的,具体)到为Windows编译的C程序。我使用了一个名为SFML库,它是绑定称为CSFML。我使用-l和-L找到库,但是当我编译我得到这个错误:

I'm using MinGW on Linux (Ubuntu, specifically) to compile a C program for Windows. I'm using a library called SFML, and it's bindings called CSFML. I'm using -L and -l to locate the libraries, but when I compile I get this error:

win32/dll/csfml-audio-2.dll: file not recognized: File format not recognised

我有不知道为什么。下面是我使用的编译命令:

I've got no idea why. Here's the command I'm using to compile:

sudo i686-w64-mingw32-gcc -o wandering src/main.c src/constants.c src/Display/display.c **...some more c files in here...** src/Generation/perlinnoise.c $(pkg-config --libs --cflags glib-2.0) $(pkg-config --libs --cflags gee-1.0) -Iwin32/CSFML-2.1/include -Lwin32/dll -lcsfml-audio-

有谁知道为什么它的发生?我可以编译C程序不SFML但MinGW的就好了......

Does anyone know why it's happening? I can compile C programs without SFML but with MinGW just fine...

推荐答案

该DLL有一个PE32可执行文件头。它不是用于连接体。您应该使用导入库,而不是。这个文件的扩展库。

The DLL has a PE32 executable file header. It's not used for the linker. You should use the import library instead. This file has the extension LIB.

我听说有一些gcc编译器版本比上飞一个DLL生成一个导入库在那里。它看起来像你的版本没有。

I heard there are some gcc compiler versions out there than generate an import library from a DLL on the fly. It looks like your version doesn't.

这篇关于DLL:使用MinGW在Linux上的Windows编译C时,文件格式无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆