haksist
haksist

Reputation: 229

C++ Cannot open lib file

I'm using Microsoft Visual studio 2013. Trying to import DevIL library to load image files i'm getting LNK1104 error: Cannot open file "IL/devil.lib"

My Source.h file which include DevIL libs in Project/Sources directory while the DevIL libs in Project/Sources/IL directory. Here is my code

#ifdef _WIN32
#pragma comment(lib, "IL/devil.lib")
#pragma comment(lib, "IL/ilu.lib")
#pragma comment(lib, "IL/ilut.lib")
#endif

Upvotes: 1

Views: 25739

Answers (2)

Cu'i Bap
Cu'i Bap

Reputation: 195

You just need to add your path lib file to Additional Library Directories in VS. Right click on your project, select Properties/Linker/General, then aim to your lib file in Additional Library Directories path.

Follow this below picture.

Upvotes: 10

wimh
wimh

Reputation: 15232

You either have to remove the directory, and use the linker settings to specify the directory;

#pragma comment(lib, "devil.lib")

or you can use a hackish way using __FILE__:

#pragma comment(lib, __FILE__"\\..\\IL\\devil.lib")

Upvotes: 1

Related Questions