🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #2085

Re: Compiling code with files with .lib extension

#2085
From: LAWRENCE M ZIEGLER
Date: Thu, 14 Dec 1995 20:41
37 lines
3052 bytes
uglmiller@cc.memphis.edu wrote:
: In article <Pine.SOL.3.91.951213191901.4036B-100000@shiva.hunter.cuny.edu>, Ohima Agans-Oliha <oaganso@shiva.hunter.cuny.edu> writes:
: > 
: > hi all,
: >  i have a problem with .lib files. for example i have a file "graf.h" 
: > with names of functions, and "graf.lib" with the prototypes. i include 
: > "graf.h" in a program "test.cpp". if i compile it tells me funcition 
: > <xxx> should have prototype. i know i am not linking the "graf.lib" file. 
: > how do i link the "graf.lib" file with the program? i used project...it 
: > didn't work. answers shall be appreciated.

You're right, you need to link the .lib file with your program, how you do it
depends on the compiler.  In most, it is done through the project file.  If 
it isn't linking you should get a "<function> undefined" type of error.  A prototype error generally only occurs when function names don't match, or sometimes
when you give the wrong number of arguments.
Some copilers also want the directories of library and include files specified.  If graph.h isn't in the working directory, or in the compiler's include 
directory, and you haven't told the comiler where else to look, you'll get the 
eror that you described, since the compiler doesn't know where to find the 
.h file with the prototypes for your functions.  I bet that this is what's
happening to you.  There are two ways to fix it, 1) look in your compiler's 
reference and find out how to list alternate search directories (for both .libs
and include files), or speciify the absolute address of the file in the include statement, like : #include "c:\graphics\include\graf.h" or wherever the file
is, then the compiler knows exactly where to find your header!!

Good luck!
Scorponok

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* "It's the wild color scheme that freaks me... Every time you try  *
*  to operate one of these weird black controls that are labled in  *
*  black on a black background, a little black light lights up      *
*  black to let you know you've done it.  What is this? Some kind   *
*  of galactic hyperhearse?"                                        *
*       		  				            *
*   Scorponok scorp@imageman.com or zieg0010@itlabs.umn.edu         *
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Technical Details
Message-ID: <DJLG8z.6xD@news.cis.umn.edu>
Path: arc1-ca.pugleaf.net!pebbles.itlabs.umn.edu!zieg0010
References: <Pine.SOL.3.91.951213191901.4036B-100000@shiva.hunter.cuny.edu> <1995Dec14.004342@msuvx1.memphis.edu>

Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer,comp.lang.c++
Path: arc1-ca.pugleaf.net!pebbles.itlabs.umn.edu!zieg0010
From: zieg0010@pebbles.itlabs.umn.edu (LAWRENCE M ZIEGLER)
Subject: Re: Compiling code with files with .lib extension
Message-ID: <DJLG8z.6xD@news.cis.umn.edu>
Followup-To: rec.games.programmer,comp.lang.c++
Sender: news@news.cis.umn.edu (Usenet News Administration)
Nntp-Posting-Host: pebbles.itlabs.umn.edu
Organization: Computer Science Department, University of Minnesota 
X-Newsreader: TIN [version 1.2 PL2]
References: <Pine.SOL.3.91.951213191901.4036B-100000@shiva.hunter.cuny.edu> <1995Dec14.004342@msuvx1.memphis.edu>
Date: Thu, 14 Dec 1995 20:41:34 GMT