Link to lib file

W

wallacej

Hi

I'm pretty new to C++, and i'm using C++ Builder 6. I am including a
file with the line:

#include <engine.h>

I have added necessary Lib path in Project->Options Directories tab. I
have been told that I need to tell it to link to a secific .lib file
called libeng.lib which is in this lib path. How do I do this?

Thank you
 
D

deane_gavin

wallacej said:
Hi

I'm pretty new to C++, and i'm using C++ Builder 6. I am including a
file with the line:

#include <engine.h>

I have added necessary Lib path in Project->Options Directories tab. I
have been told that I need to tell it to link to a secific .lib file
called libeng.lib which is in this lib path. How do I do this?

Thank you

That's not a C++ language question. It's a question about how to use
your compiler.

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9

Gavin Deane
 
S

Simon Elliott

I'm pretty new to C++, and i'm using C++ Builder 6. I am including a
file with the line:

#include <engine.h>

I have added necessary Lib path in Project->Options Directories tab.
I have been told that I need to tell it to link to a secific .lib file
called libeng.lib which is in this lib path. How do I do this?

I usually find it's easier to hand edit the .bpr project file than to
try to get the IDE to do this correctly. It's an XML file internally
and the format is pretty intuitive.

You might find that the folk over in borland.public.cppbuilder.* have
some better ideas. You'll need to point your newsreader at
newsgroups.borland.com to get these groups.
 
B

Bernd Muent

wallacej said:
I'm pretty new to C++, and i'm using C++ Builder 6. I am including a
file with the line:

#include <engine.h>

I have added necessary Lib path in Project->Options Directories tab. I
have been told that I need to tell it to link to a secific .lib file
called libeng.lib which is in this lib path. How do I do this?

You will need something like:
#pragma link "libeng.lib"

Otherwise you will get a lot of unresolved external symbols.

B.
 
S

Simon Elliott

You will need something like:
#pragma link "libeng.lib"

Otherwise you will get a lot of unresolved external symbols.

That's one way. The alternative is to make sure that you enter the lib
paths and then edit the .bpr file, adding or editing two parts:

in
<PROJECT>
<MACROS>

<LIBFILES value="mylib1.lib mylib2.lib"/>


in
<PROJECT>
<FILELIST>

<FILE FILENAME="mylib1.lib" FORMNAME="" UNITNAME="mylib1.lib"
CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/>

<FILE FILENAME="mylib2.lib" FORMNAME="" UNITNAME="mylib2.lib"
CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/>

If you do this, the linker will look for mylib1.lib and mylib2.lib on
the lib paths.

In theory you can enter the library names via IDE, using the project
manager, but I always find, when I do this, that the absolute paths of
the libraries are added in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top