开发者

Static libpng link with visual studio 2010

I'm tryin开发者_如何学JAVAg to add PNG support to my application and thus I want to include libpng. I know it needs zlib and thus I downloaded that as well. I went into the png folder/projects/vstudio and I opened the solution. I compiled it and it went just fine. I added some headers from it into my application and I copied the lib files. My program is a dll written in c++ which is later used from C#. When I run it in C# it complains about not finding my dll (tough if I remove the png part it works fine). I've had this problem before and it usually means a dll dependency is wrong.

Now... libpng compiled both some .lib files and some .dll files. The dll files are bigger. My only guess is that it needs the dll files as well but I've seen that people can link to libpng without a dll.

So my questions is: How can I compile libpng(and zlib for that instance) into just static libraries and how can I include those in my projects? I've searched around the internet and I couldn't find anything useful.


To make all your libraries static, you would have to recompile everything "from scratch" as static libraries.

This simply means you should create a set of projects for each library you have in your sequence and set the output type to static library.

After that you should eliminate library dependencies between the libraries themselves (this means you should link the output of some projects to another projects, e.g. if your "libpng" library uses "libzip", it means you should first compile the "libzip" and link that output (static library) to your "libpng" project.

In the very end you would have a big set of static libraries compiled for your platform, which you can use in your projects.


Also to mention, try googling more carefully. I'm sure someone has this done and you would probably need to download a package of .lib files for your platform (I know that very often the "dev" bundle of libraries only includes an import library paired with appropriate .dll file, but there are a lot of enthusiasts like you :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜