×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

link lib file
2

link lib file

link lib file

(OP)
How do I link a lib file to my project?
Where do I set the path to the lib file?

Thanks,
Best regards.
Paul.

RE: link lib file

I know of two basic methods to link to a *.lib file.  For both options you have to add to either your *.cpp file or your *.h (preferable) the #include statement for the header file.

CODE

#include "..\Function Collection\visa.h"

1.)  In the IDE, click "Project"|"Add to Project..."
2.)  In the "Add to Project" OpenDialog window, change the "File type" to "Library File (*.lib)"
3.)  Specify the *.lib file and click "Open"

The other method is to include in the header file using a #pragma statement:

CODE

#pragma comment(lib, "C:\Documents and Settings\stemay\My Documents\Programs\Function Collection\visa32.lib")

I usually employ the first method unless I am building a wrapper class to conveniently use the functions made available by the *.lib.

Steve.

RE: link lib file

(OP)
Thanks Steve, but how about the dll? do I have to include it somewhere? Maybe set a path?
I've put the dll in the same project's folder, but the linker cannot find it.
Every time I run I got a message of missing dll.

Thanks again,
Best Regards,
Paul.

RE: link lib file

Which version of C++ Builder you are using? Because there are quite some differences.

RE: link lib file

(OP)
C++ Builder 2007

RE: link lib file

Ensure you've checked the properties in Tools/Option/C++ option/path and Diredtories and ../Project Properties.

C++ Builder 2007 can make it very easy for you if Include Path is checked in Tools/Option/C++ option/Project Properties, which is the default option.

You need to install your dll.
Component/Import component/Active X. then click next and follow the instructions.

C++Builder 2007 will do almost all the work for you. Version 2007 has many enhancements in comparison with earlier versions.

The error Cannot find it also means that the Dll isn't install correct. Uncheck the option during the installation of the dll: "link with rtl" almost always solve this problem.

 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close