Archived

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

shdaga

MSVC 6.0 and .lib files

Recommended Posts

Currently every time I make a new project, I have to go to the project settings->linker tab, and add all of the directX .libs, plus any other pertinent .libs. I was wondering if there was a way to do this once, and have every project I make from then on automaitcally find em. I''ve already tried copying the directX .libs to the MSVC lib folder, but that seems to have no effect so far. Any suggestions? Thanks.

Share this post


Link to post
Share on other sites
Yes there is a solution.

When you write your engine, create a header file you will include in all of your (future) projects. This file contains all the lib you need to link :


...

// Librairies to link
#pragma comment(lib,"dxguid.lib")
#pragma comment(lib,"dxerr8.lib")
#pragma comment(lib,"ddraw.lib")
#pragma comment(lib,"dsound.lib")
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"dinput8.lib")
// add any other lib you want ...
...




__________________________



Bruno Wieckowski
Lead Programmer
Exood4 Studios

Share this post


Link to post
Share on other sites
Thanks for the reply. Would I still have to use #includes as well in the header file, or do the #pragma statements replace em?

Share this post


Link to post
Share on other sites
Wait,I see what you mean now. Just create a header file, like directX.h or something and in that file put all the #pragmas, and then include it in all of my other engine files. Is this correct?

Share this post


Link to post
Share on other sites
I have a question: Do I need to include those #pragmas in every CPP file, or just one? It makes sense to just have it once, because the linker only gets called once

Share this post


Link to post
Share on other sites
I typically put those in my Stdafx.cpp file -- I don''t know if it''s a good idea to put them in a header file that''s included more than once, but I suspect that probably works okay too. Putting them in Stdafx.cpp -- or any other .cpp file -- works perfectly.

Cheers, dorix

Share this post


Link to post
Share on other sites
You also have to make sure that the path to your DirectX libraries is known to the compiler. In Tools/Options/Directories, click the drop-down box and choose Libraries, and make sure DirectX is there.

I also slightly misunderstood your original question. If you use the #pragma comment lines, they have to be in a file that''s compiled or #included in every project you do.

Cheers, dorix

Share this post


Link to post
Share on other sites