Sign in to follow this  
Quak

link library

Recommended Posts

Hi, i'm using VC++ 6 and want to link a library to my programm thats not in the compiler's directory. I searched the help section but couldn't find an answer. thanks

Share this post


Link to post
Share on other sites
It's been a while since I've used VC6 but it something like Tools->Options->Directories.

Once you have the right page you'll need to change the drop down option to "library files", you can then add a new search path for the lib files.

Share this post


Link to post
Share on other sites
Thanks, it's working. But I still get 2 unresolved errors.
Is it possible that the linker uses the library in his native directory rather then mine(which have the same name)? I'm trying to link ddraw.lib to my project...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Put the link right at the top, cuase it seems your using directx. If you dont put it at the top youre basically saying use directx3.0

Share this post


Link to post
Share on other sites
Linking...
blackbox.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Release/freakout.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

This is the error. I've included ddraw.lib only.
A problem seems to be that in both directorys, the default one and the one I've added contains a ddraw.lib.

Share this post


Link to post
Share on other sites
Quote:
Original post by Quak
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main


generally this comes from having the project settings be for a console app, but you're actually coding a windows app. if you have a WinMain in your program you need to change the settings (don't remember how) such that the project knows it's a windows app. if you have neither a main nor a winmain you need one or the program won't know how to run.

-me

Share this post


Link to post
Share on other sites
Quote:
Original post by Quak
and it is a win32 app.


not if it's complaining about "unresolved symbol _main"

make sure in your linker properties that subsystem is set to windows, not console.

-me

Share this post


Link to post
Share on other sites
Shame on me you were right ;(
But there is still this error:
Linking...
blackbox.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16
Release/freakout.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

any idea?

Share this post


Link to post
Share on other sites
Try manually adding the required lib file to your project as you would a cpp or header file. It will automatically be linked into your game and at least this way you can be sure the lib file you are using is the one you want.

Share this post


Link to post
Share on other sites
try:


#pragma comment(lib, "C:/PATH_TO_THE_LIB/ddraw.lib")




of course the best thing is to just put the lib into you "lib" folder, i think directX is always backwards compatible so you only stand to gain from that.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Looks like youre going thru tricks of the game programming gurus by the look of the files...

Just follow his example, check your code if you typed it in manually and follow his instructions for setting up vc++ in the appendix.

Which btw is an awesome book, excellent choice!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this