在MinGW中使用lib文件 [英] Using lib files with MinGW

查看:935
本文介绍了在MinGW中使用lib文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想知道是否可以使用gcc创建lib文件并将其也用于gcc.作为lib文件,我的意思是Microsoft CL生产的扩展名为lib的文件,看起来像"advapi32.lib".我的平台是Windows NT.我已经知道我可以从.o文件中生成和使用.a文件.对于我来说,构建整个事情的理想命令集是这样的:

对于图书馆:

Hi, I was wondering whether it is possible to create lib files with gcc and use them also with gcc. As lib files I mean the files produced by Microsoft CL that have the extension lib and look like "advapi32.lib". My platform is Windows NT. I already know that I can produce and use .a files from .o files. An ideal set of commands for me to build the whole thing would be like this:

For the library:

gcc -c libfile1.c -o libfile1.o
gcc -c libfile2.c -o libfile2.o
gcc -o sample.lib libfile1.o libfile2.o


对于程序:


And for the program:

gcc -c appfile1.c -o appfile1.o
gcc -c appfile2.c -o appfile2.o
gcc -o app.exe appfile1.o appfile2.o -l sample.lib

推荐答案

不.没办法.

MS编译器生成.lib文件,GCC生成.a文件.

您无法将.a文件链接到使用Visual Studio的项目.您也无法通过GCC将.lib文件链接到项目.

您想做什么/实现?
Nope. No can do.

MS compiler produces .lib files, GCC produces .a files.

You can''t link .a files to projects with Visual Studio. Nor an you link .lib files to projects with GCC.

What you trying to do/achieve?


这篇关于在MinGW中使用lib文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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