4

I need use SOIL library in my project. My steps:

  1. download and extract zip to my project folder

  2. rename libSOIL.a to SOIL.lib

  3. Properties >> C/C++>General >> Additional include directories - Add "./SOIL/src"

  4. Properties >> Linker >> General >> Additional Library Directories - Add "SOIL.lib"

  5. put #include "SOIL.h"

Function *SOIL_load_image* was found but

error LNK1104: cannot open file 'SOIL.libkernel32.lib'

Andrea
  • 11,801
  • 17
  • 65
  • 72
Hricer
  • 173
  • 1
  • 8

2 Answers2

17

I know this question is a couple weeks old now, but I figured it can't hurt.

The actual error you are getting is (probably) because you are missing a semicolon in the list of libraries to link.

If you go to Properties -> Linker -> Input -> Additional Dependencies (which I assume you must have gone to, though it isn't in your list of steps), it should say something like SOIL.lib%(AdditionalDependencies).

If you change that to SOIL.lib;%(AdditionalDependencies) (note the semicolon!), then that error should disappear.

What %(AdditionalDependencies) does is append some other libraries that Microsoft knows (or thinks) that you will need. The first of those is kernel.lib, so without a semicolon to seperate your SOIL.lib and kernel.lib, the linker tries to find SOIL.libkernel.lib, which does not exist!!

Numeri
  • 1,027
  • 4
  • 14
  • 32
2

And here

2) rename libSOIL.a to SOIL.lib

you went all wrong. The name libSOIL.a indicates that you downloaded a build intended to be used with a GCC toolchain. Libraries with a filename to the scheme of lib….a use a different format than libraries named ….lib.

You need a SOIL build for VC++.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • I can not find SOIL build for VC++ to download.:( – Hricer Nov 16 '13 at 13:56
  • 1
    @Hricer: SOIL is Open Source. You can (and should) build it yourself. – datenwolf Nov 16 '13 at 14:00
  • i'm really sorry for my ignorance but how build SOIL for vc++ in VS2012 – Hricer Nov 16 '13 at 14:43
  • @Hricer: I think the easiest in your case would be, that you simply copied the SOIL source files into your project and just add the source files to your project. Since SOIL is in the public domain this is perfectly fine to do. – datenwolf Nov 16 '13 at 14:47