Archived

This topic is now archived and is closed to further replies.

cnstrnd

Include Libraries at source level

Recommended Posts

cnstrnd    118
I already use #pragma comment( lib,"opengl32.lib" ) to include OpenGL lib under MSVC. But now I want to be able to use such syntax to include my own libs :
    
// C:\AllMyLibs\mylib\mylib.h




// Adding 'C:\AllMyLibs' to lib directories

#if defined( _DEBUG )
#  pragma comment( lib, "mylib\\Debug\\mylib.lib" )
#else
#  pragma comment( lib, "mylib\\Release\\mylib.lib" )
#endif
// Linker error : can't find 'mylib\Debug\mylib.lib'


// Adding 'C:\AllMyLibs\mylib\Debug'

#pragma comment( lib, "mylib.lib" )
// Works


// (...)

    
Am I doing something wrong ? Thanks [edited by - cnstrnd on March 17, 2003 10:10:53 AM]

Share this post


Link to post
Share on other sites
Rick Scott    133
Isn''t the current directory already "mylib"? If so, then you would just use

#pragma comment( lib, "Debug\\mylib.lib" )

or an absolute path might work:

#pragma comment( lib, "C:\\AllMyLibs\\mylib\\Debug\\mylib.lib" )

Share this post


Link to post
Share on other sites