I cant get SOIL working correctly with Visual Studio 2010 – I’m far from an expert with VS but as far as I know only the following steps are necessary to get the environment working:
Properties>>C/C++>General>>Additional include directories Add in the path to SOIL.h
Properties>>Linker>>General>>Additional Library Directories Add in the path to libSOIL.a
I am also using free GLUT and the paths to the glut files are set here as well – I also set the Dubugging>>Environment Path to the GLUT bin file.
When I use the SOIL_load_OGL_texture I get the following error:
error LNK2019: unresolved external symbol _SOIL_load_OGL_texture referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
Tried renaming libSOIL.a to libSOIL.lib and SOIL.lib but it didn’t work. I then built the VC8 project and used that .lib as suggested here SOIL not linking correctly but that didn’t work either.
I am using sample code from their homepage
GLuint tex_2d;
tex_2d = SOIL_load_OGL_texture
(
" C:\\Sunset.png",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
);
/* check for an error during the load process */
if( 0 == tex_2d )
{
printf( "SOIL loading error: '%s'\n", SOIL_last_result() );
}
May be it's little old thread, still I will share something.
Download the zip from http://www.lonesock.net/soil.html and unzip it.
In your visual studio project include path (project -> properties -> vc++ directories -> include directories) add the path to "src" folder of Soil. Same place of -> library directories add the "lib" folder. project -> properties -> Linker -> Input -> Additional Dependencies -> Edit to add "SOIL.lib"
This step is important as people tend to rename that .a file to .lib. Don't do that. Instead go inside "projects" folder, select a VC* (eg VC8 for VS2012) -> open the visual studio file -> it will open using your visual studio -> click ok -> click ok. Your solution will be Ready.
Now press F5/Run to build and Run. Be careful while doing it, in case your project is using a x64 Debug version then in here select the same before you build the solution.
At this point, you are done. It should work.