Reputation: 1858
So I have my solution file here, which contains 4 projects.
I have set up Project A as dependency for Project B, and I included
#pragma comment(lib,"terrain.lib")
into the file in Project B which uses the library.
In spite of both projects being compiled into the same Debug / Release folder, MSVCC tells me
1>LINK : fatal error LNK1104: File "terrain.lib" could not be opened.
// <freely translated from German, could mean "not found">
This:
#pragma comment(lib,"../Debug/terrain.lib")
works, but then I have to change it for release.
Is the only valid way for this using #ifdef ?
Upvotes: 2
Views: 1268
Reputation: 26419
You need to specify library path in project settings ("additional library directories" in linker settings - at least in vc2008), for both debug and release configuration. You can use macros like ${ConfigurationName} and ${SolutionDir}, so specifying paths within project should be easy enough.
Also it might be a better idea to include libraries using linker settings instead of #pragma comment
.
Upvotes: 1