Reputation: 7151
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.
Upvotes: 2
Views: 43352
Reputation: 521
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!
Upvotes: 2
Reputation: 2862
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());
}
Upvotes: 4
Reputation: 409
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'? )
Upvotes: 10
Reputation: 3801
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.
Upvotes: 3