How does the MSVC 6.0 complier/linker find external headers, includes and stuff

Started by
3 comments, last by GameDev.net 18 years, 5 months ago
G'day I'm beating my head against wall with MSVC6.0. I've got a bunch of libaries which I want to use that live in seperate directories. So I need to tell MSVC6.0 where to look when I call an include and where the dlls are when link; I think thats all it needs to know. I tried playing around with the directories under options but it still didnt work. I really don't know how it works and couldn't find any general n00b friendly resources. If someone wouldn't mind explaining the process behind the complier/linker searching for stuff, or pushing me towards an online resource I would be very very greatful. Cheers
Advertisement
The compiler do not need to know where the dlls(.dll files) are, you should tell the compiler where the libraries(.lib files) are. Then just add somthing like:
#pragma comment(lib,"yourlibrary.lib")
to your source file and compiler.
It's in the compiler's options somewhere. I do not have MSVC++ 6.0, but there is an external dependencies options tab where you add a list of the directories that contain your .h and .lib files.

Then you specify in the individual project settings which .lib files to link in. Or you can also link by using the #pragma directive as shown by Kambiz.

The DLLs go into C:\Windows, or into some other folder on the %PATH% environment variable.
thanks for the replies mate, How do i add extra paths to the environment variable. I tried path = path + blah and path = path & blah, in a command window but that was rather bad lol.
In Visual Studion 6, the include and lib search paths can be found:

Tools -> Options -> Directories Tab

To tell the project which libraires to link to, use:

Project Options -> Link Tab, and add to the list of libs.

Put any required DLL's in the same directory as the app, or in the windows system directory - OR add the directory you want them to be in to the environment variables, found here:

Richt click My Computer -> Properties -> Advanced.

This topic is closed to new replies.

Advertisement