How do I compile a library in windows?

closed account (2NywAqkS)
I have download the SOIL library
for loading textures in OpenGL, however it doesn't come with a SOIL.lib file but a file called libSOIL.a
and it says I need to compile it myself.

How do I do this?
As long as you're using a MinGw or an MS compiler you should be fine just linking to it. They say you can compile it yourself, not that you need to.
closed account (2NywAqkS)
if I put in
#pragma comment(lib, "libSOIL.a")
I get two errors
error LNK2001: unresolved external symbol __alloca
error LNK2001: unresolved external symbol _sqrtf
It links fine with the updated version of Mingw. What IDE and\or compiler are you using?
closed account (2NywAqkS)
Visual Studio 2010
.a files wont link with Visual Studio, they where built with/for MinGW. Visual Studio requires .lib files.

The SOIL download comes with VC solutions, the newest appears to be for vs2008. Open it in VS2010, convert it and build it.
Last edited on
naraku9333 is probably right, I wanted to give the website the benefit of the doubt because they clearly state that it WILL work with an MS compiler but generally anything with the lib prefix and '.a' extension was built for MinGw.
Last edited on
To actually answer your question OP, you would start a new project and designate it as a library then copy and paste the source code in. From there MSVS will know what to do.
I was able to build the solution in projects/VC9 with VS2012. It built without error but I haven't tried linking to it (I know nothing about SOIL).
closed account (2NywAqkS)
Thanks, guys!
Just link to the new file like you tried to do with the old one and then include the header file.
closed account (2NywAqkS)
Struggled around with it for a while but I got everything just working!
Topic archived. No new replies allowed.