2

The SOIL website doesn't have any installation instructions. The file I downloaded has no readme. I failed to find anything with Google.

I doubt g++ is going to check every directory on my computer to see if it can find it. Is there a specific folder I'm supposed to put it in? Is there a script I'm supposed to run?

I'm using Ubuntu.

DanielLC
  • 5,801
  • 5
  • 18
  • 16
  • downloading the zip file, and doing `make` from `projects/makefile` folder is the way, but I got an error - `can't create obj/image_helper.o: No such file or directory`. I had to create obj directory in `projects/makefile` (mkdir obj), and then make proceeded fine. You will find the built file at `Simple OpenGL Image Library/lib/libSOIL.a` – Sahil Singh Jul 21 '19 at 10:47

4 Answers4

9

As suggested on Compiling OpenGL SOIL on Ubuntu,

First download the SOIL.h header file from its website http://www.lonesock.net/soil.html

Place the header file in your project directory and include it in your project file.

#include "SOIL.h" 

After that you have to install the soil library to use -lSOIL. To install the library use the command

sudo apt-get install libsoil-dev

Now compile the project using gcc along with -lSOIL

And in case you face the error:

undefined reference to 'SOIL_load_OGL_texture'

then link libSOIL before linking libopengl32 while compilation,for example:

g++ -g source.cpp -lglu32 -lSOIL -lopengl32 -lfreeglut

(source: undefined reference to `SOIL_load_OGL_texture'? )

Community
  • 1
  • 1
uutsav
  • 389
  • 5
  • 16
  • Installing SOIL by "sudo apt-get install libsoil-dev" and then referring to the header file located in the usr/include folder (#include ) is better solution in my opinion. Unfortunately, the link http://www.lonesock.net/soil.html became inactive. – JacobTheKnitter Sep 16 '22 at 13:56
4

Question is about Ubuntu. However I was looking for how to get it working in Windows. But in the end is was not so complicated.

Download the soil.zip.

Browse to "Simple OpenGL Image Library\projects\VC9".

Open the SOIL.sln. I have VS15 so I had to upgrade the solution for it. It was automatic without any issues.

Then I build the solution and SOIL.lib was created.

I took this .lib file and put it in my project folder.

Added dependency in my Project - Properties/Linker/Input/Additional Dependencies

Took SOIL.h from "Simple OpenGL Image Library\src and put it in my project folder.

Then I had to include the header file

#include "SOIL.h"

and I can use it for loading image like this:

GLuint tex_2d = SOIL_load_OGL_texture
    (
        "pic.png",
        SOIL_LOAD_AUTO,
        SOIL_CREATE_NEW_ID,
        SOIL_FLAG_MIPMAPS | SOIL_FLAG_COMPRESS_TO_DXT
        );

if (0 == tex_2d)
{
    printf("SOIL loading error: '%s'\n", SOIL_last_result());
}
rluks
  • 2,762
  • 8
  • 38
  • 56
  • 1
    Thanks! It was easy. I spent longer searching for binaries than it took to actually just build it myself. –  Aug 18 '16 at 05:13
3

Navigate to the projects/makefile folder and type:

$make
$make install

Then you can use this library simply including SOIL.h in your C++ file.

cpp
  • 3,743
  • 3
  • 24
  • 38
2

I found this repository SOIL on GitHub. Clone the repository to your machine and then perform the following operations on the command line on Linux systems: make make install Then you are done!

khwilo
  • 481
  • 4
  • 9