How do I compile a library in windows?

Mar 7, 2013 at 7:08pm
closed account (2NywAqkS)
I have download the SOIL library
http://www.lonesock.net/soil.html
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?
Mar 7, 2013 at 7:20pm
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.
Mar 7, 2013 at 8:41pm
closed account (2NywAqkS)
if I put in
#pragma comment(lib, "libSOIL.a")
I get two errors
1
2
error LNK2001: unresolved external symbol __alloca
error LNK2001: unresolved external symbol _sqrtf
Mar 7, 2013 at 8:45pm
It links fine with the updated version of Mingw. What IDE and\or compiler are you using?
Mar 7, 2013 at 8:56pm
closed account (2NywAqkS)
Visual Studio 2010
Mar 7, 2013 at 9:05pm
.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 Mar 7, 2013 at 9:07pm
Mar 7, 2013 at 9:08pm
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 Mar 7, 2013 at 9:08pm
Mar 7, 2013 at 9:23pm
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.
Mar 7, 2013 at 9:58pm
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).
Mar 7, 2013 at 10:07pm
closed account (2NywAqkS)
Thanks, guys!
Mar 7, 2013 at 10:09pm
Just link to the new file like you tried to do with the old one and then include the header file.
Mar 7, 2013 at 10:18pm
closed account (2NywAqkS)
Struggled around with it for a while but I got everything just working!
Topic archived. No new replies allowed.