在VisualC ++项目中使用通过GCC编译的库(反之亦然) [英] Using libraries compiled with GCC in a VisualC++ project (and vice versa)
问题描述
可以在使用GCC作为编译器(反之亦然)的项目中使用用VisualC ++编译的代码(和库)(所以使用.lib扩展名)?或者我必须重新编译它们?
我试图使用Visual C ++编译的Soc 3.1库来编译一个以GCC为编译器的项目,但是我收到了一些错误, 't知道为什么。
你必须使用MinGW工具为GCC创建二进制文件:reimp和dlltool。这里是MinGW的wiki,其中有完整的程序说明: MSVC和MinGW DLL
简短示例:
pre $ reimp -d libmysql.lib
dlltool -k - -input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a
reimp libmysql.lib
顺便说一句,这里是相关的线程在SOCI用户邮件列表上: MySQL生成失败。寻找线索中给出的有用链接。
It's possible to use code (and libraries) compiled with VisualC++ (so with .lib extension) in a project that will use GCC as compiler (and vice versa)? Or I have to rebuild them?
I'm trying to use SOCI 3.1 libraries that I have compiled with VisualC++ in a project that has GCC as compiler, but I'm getting some errors, and I don't know why..
You have to produce binaries for GCC using MinGW tools: reimp and dlltool. Here is MinGW wiki with complete explanation of the procedures: MSVC and MinGW DLLs
Short example:
reimp -d libmysql.lib
dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a
reimp libmysql.lib
By the way, here is related thread on SOCI users mailing list which: MySQL Build fails. Look for useful links given in the thread.
这篇关于在VisualC ++项目中使用通过GCC编译的库(反之亦然)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!