how to include .lib files?

I originally had Visual Studio 6 on my computer. But then I felt it was getting old so downloaded Visual C++ Express 2005 (VC++2010 didn't run on my computer, it has pentium 4)

VC++6 was full version so it had <windows.h> on it, while VC++2005 doesn't.

So I put VC++6's include folder and library folder in 'VC++ Directories' of VC++2005.

But this doesn't work as expected. I have to include library files using #pragma comment(lib,/*name of lib file*/) . I have to lookup MSDN to know that in what .lib file a function is in. This is frustrating. Is there a way out?

Why is it that a compiler can automatically include library files associated to the headers which came with it and not to other headers?
Library files for VC6 will not work with VC2005 anyway (you most likely will get linker errors if you try).
I think you need Windows SDK for VC2005 installed or is some bad installer kit you are using if you don't have even windows.h in your system.

And please uninstall completely VC6 before installing any newer version or you will have issues.
I don't get any linker errors. The program works fine. But the difference is that I have to include the required .lib file by using #pragma in VC++2005 while I don't need to do so in VC++6.

I just want to know why does this difference exists and how can I fix it.

I didn't install Windows SDK. <windows.h> came with VC++6. I redirected VC++2005 to use this header file. I also redirected it to use the .lib files that came with VC++6. But it didn't automatically include them. So I have to manually include it by using #pragma.
So I put VC++6's include folder and library folder in 'VC++ Directories' of VC++2005.
Never copy header files between different compilers.

... so it had <windows.h> on it, while VC++2005 doesn't.
It's installed by the Platform SDK, the installation should have sorted it out for you.

But this doesn't work as expected.
That's why you fix the installation and not copy files around.

Is there a way out?
Uninstall VS2005, remove copied files, reboot, install VS2005.

moderan
And please uninstall completely VC6 before installing any newer version or you will have issues.
Don't do that, VC6 and VS2005 can coexist on the same computer without any problems at all.
Last edited on
I didn't copy files around!

I copied the path of the include folder of VC++6.
I opened the VC++ directories option of VC++2005.
I pasted the path in the include folders list in VC++ directories.

I did a similar thing with the library files folder of VC++6

VC++6 and VC++2005 don't mess with each other. They peacefully coexist on the computer.

There is an link "Download the PSDK" on the start page of VC++2005 but it takes me to some other page (which enlists Visual Studio 2010 express products)

Moreover, I think that if VC++6 already contains Win32 API then why do I need to download it again?

Even if there are some features missing in the older version, I don't care because I don't make GUI based programs. I just use Win32 API for small things and only when there is no other good alternative. For eg, I use SetConsoleTitle() to change the title bar of console windows, CopyFile() to copy files and SHFileOperation() to make and delete folders, etc.

If any of you know what are the names of the .lib files in the 'library' folder and which header files they are related to and will tell them to me, I will manually include the .lib files. For eg, at the end of shellapi.h, I can put the line #pragma comment(lib,"shellapi")


Last edited on
Shouting doesn't help.

It's taken a while to onto a Windows box.

VS2005 installs the SDK under:
Microsoft Visual Studio 8\VC\PlatformSDK

You should check your VS2005 for that directory. BTW, do you have a hacked installation source or a legitimate ISO?
I checked VC++2005 for the folder, but it doesn't exist. I heard that Express Editions of Visual Studio don't come with an inbuilt Platform SDK.

I don't know what "a legitimate ISO" means, but I downloaded VC++2005 Express from Microsoft's website.
I didn't realise you're using the Express Edition. I've never used an Express Edition, so I my comments so far probably don't apply.

If you're missing the SDK, just install it seperately.
It's not that I'm missing the SDK. I have it but it has come with VC++6. I have said it in my earlier replies why I don't want to download and install one separately. I have also written in my first post that I'm using an express edition.

kbw, maybe you should carefully read my earlier replies.
Some people ...
Hi, I've got nothing to add to the topic at hand. I'd just like to ask eklavya to either put away his passive-aggressive bullshit such as "maybe you should carefully read my earlier replies", or take it somewhere else where people will put up with that kind of thing.
I'm sorry. I didn't mean to offend anyone. I'm not passive and aggressive. But I don't want people to post here without carefully reading my earlier replies. It wastes both my and others' time and also uses up space on this site. I couldn't find a polite enough way to say what I said to kbw. If this hurt anyone's feelings, please forgive me.

I want to know if there a way to redirect VC++2005 express to use Win32 API library files of VC++6. Also, can anyone please tell me how does an IDE know that a particular header file is related to a library file. For eg, if I include <shellapi.h>, how does VC++6 (with a PSDK) know it has to link to shellapi.lib?
Last edited on
You need windows sdk for visual studio 2005 (latest sdk is not compatible I think), not sure if you can find it, maybe on torrent sites.
The IDE does not know what library to use just by including a header file (it is possible to specify that in a #pragma directive though), but the usual way is to consult msdn documentation.
Topic archived. No new replies allowed.