1
votes

The distribution of assimp comes with a lib folder. This folder has the following sub folders :

assimp_debug-dll_win32
assimp_debug-dll_x64
assimp_release-dll_win32
assimp_release-dll_x64

Each of those folders has a single file, assimp.lib. How can I include the correct lib based on my configuration (debug/release)? Currently, assimp is in a folder outside of my project and I've added the paths to Tools->Options->VC++ Directories->Library files, but I'm not sure its working.

3
If you go to project properties, each configuration(debug/release...) has it's own set of settings. You can go to linker options for individual configurations and set additional lib dependencies. - Bala R

3 Answers

2
votes

You should add the library directories to the project itself rather than as a global setting in visual studio.

To do this, you can right click on the project in the solution explorer. Then under the VC++ directories section, add in the correct path to assimp. You should just add the path that corresponds to the current (i.e. debug or release/win32 or x64) setup to this list. There should be a drop down at the top to select the current configuration that you are editing.

This applies to VS2010 anyway, I'm not 100% sure about VS2008. The library path may be under Project Settings -> Linker ->General -> Additional Library Directories if the VC++ directories section does not exist.

1
votes

You should be branching the include paths for each build configuration using properties -> linker -> additional include directories. this will solve your problem.

a secondary option is to use #pragma comment(lib,"<lib name>") and use the path to the library you want to link to, then using #if/#endif you can branch based on the current build version.

you can test it using dependency walker, process explorer or any debugger.

1
votes

You could do it using preprocessor directives:

#ifdef __DEBUG
#pragma comment(lib,"c:/Path/assimp_debug-dll_win32/assimp.lib")
#else
#pragma comment(lib,"c:/Path/assimp_release-dll_win32/assimp.lib")
#endif