Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: beave on June 28, 2010, 05:14:51 pm
-
Hi guys,
I've spent the better half of a day trying to figure out how to create .lib files for windows when compiling on linux.
I've followed the guide on setting up mingw32 to cross compile for windows but it doesnt create the lib file for the dll (as the documentation states when building on linux)
The closest i've got is this post:
http://forums.codeblocks.org/index.php/topic,3343.msg55888.html#msg55888
but that hasnt worked.
Also, the forum post and wiki differ when setting the linker, ie ar compared to ld. Whats the difference and which one should I use?
I'm using cb 10.05 on ubuntu 10.04 32bit
I appreciate any help.
-
ld creates shared libraries (dlls)
ar creates static libraries, the resulting file is just an archive with all the compiled object files.
I don't think that it is possible to make .lib from .a.
Probably this link could help: http://www.codeproject.com/KB/cpp/libfromdll.aspx
google search string: "howto make lib from dll"
-
thanks for the clarification, so this step in the how to is wrong then:
http://wiki.codeblocks.org/index.php?title=File:Settings_compiler_debugger_programms.png
(well it fails when i set it to ld so i guess it is)
I was also looking at some windows tools running under wine to create the lib file. I found how ffmpeg does this here:
http://ffmpeg.arrozcru.org/wiki/index.php?title=Cross-compiling
But will using VC++ tool create lib files that can work with MingW? Or is it just the dll that differ?
thanks for the help so far.
-
no need to convert the .a files to .lib for mingw, mingw itself uses .a libraries not .lib as default.
files with .lib extention are ms compiler format and as such only needed if you need a specific library from gnu with msvc.
the difference from ms library format is that mingw libraries have .dll.a for libraries that link to a dll.
-
cheers reckless you've saved me a whole lot of time.
I did a quick test and you're right, mingw can link just against the dll. I was under the impression it needed the lib.
-
Hm, are you sure? I think it requires the .a file.
-
Hm, are you sure? I think it requires the .a file.
Works for linking Code::Blocks dll every time I tried it.
Tim S.
-
most welcome :)