开发者

Using gcc libraries with mingw for cross-compiling?

开发者 https://www.devze.com 2023-03-24 15:15 出处:网络
While I am sure that gcc libraries (.a) are incompatible with mingw lubraries (also .a), I want to know. Can I cross-compile a windows executable with mingw using the gcc .a library generated for unix

While I am sure that gcc libraries (.a) are incompatible with mingw lubraries (also .a), I want to know. Can I cross-compile a windows executable with mingw using the gcc .a library generated for unix systems?

In code form, keep in mind this is a unix system:

cd mylibrarydirectory/
make #produces mylibrary.a
cd ../myprogramdirectory/
gcc -o UnixExecutable mysrc.c -L../mylibrary.a
#and I  get a valid unix executable
i586-mingw32msvc-gcc -o Win32Executable.exe mysrc.c -L../mylibrary.a
#will I get a valid windows executable?
开发者_如何学编程


No. You have to recompile the library for Windows.

The second command should give an "incompatible library format" or something error. Or at least undefined references to whatever is linked in.

0

精彩评论

暂无评论...
验证码 换一张
取 消