View Full Version: library files and vc++

C++ Learning Community > C++ Tips > library files and vc++


Title: library files and vc++
Description: works for 5.0 anyway


ih8censorship - August 13, 2003 02:07 AM (GMT)
ok i recently had a little experience adding .lib files to my programs . in vc++ 5.0 one way you can add a lib file is by going to project>settings>link then by typing the apropriate .lib into an edit box. seems like a lot of work to do unless you needed a ton of .libs but the easyer way of doing this is by simply typing
CODE
#pragma comment(lib, "alibrary.lib")
right under your headers. i hate when things are harder than they have to be.

TheHawgMaster - August 13, 2003 04:45 AM (GMT)
Yes, I suppose, but try porting that to a Borland compiler ;)

Nice though, I had no idea you could do that.

dr voodoo - August 13, 2003 08:06 AM (GMT)
I'm using the Borland's commandline compiler and it knows the "pragma" precompiler command. I don't know if that would work but I always use it to link *.res files into my exe. Like this:
CODE
#pragma resource "resource.res"

I normally add *.lib files when writting the compile *.bat so I haven't tested that yet but I don't see why it wouldn't work.

TheHawgMaster - August 13, 2003 03:53 PM (GMT)
The #pragma directive is compiler defined, so my compiler's #pragmas will almost for sure not be found on your compiler.




* Hosted for free by InvisionFree