Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

including a library

Posted on 1999-07-09
6
Medium Priority
?
193 Views
Last Modified: 2013-11-18
I am using BC++ 4.5, i created a console application
and i want to use an existing library in my application.
I got a list of .h files and .lib files, i included
the path for both .h(include) and .lib(lib)
in options->project->directories->source directories,
When i tried to include one of those .h files in my .cpp
file, it is giving an error message saying "unable to open that file".

Can anybody tell me whether i am missing anything or is there any other way of doing it .....

Thanks in advance.
0
Comment
Question by:kirthir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 40 total points
ID: 1199651
options->project->directories->source must be to dir,
where are you source (c/cpp) texts.
For include you .h files you  , of couse ,use
#include  statement. If this h file is in you dir
you write simple
#include "my.h"
but if h file in other place, best way is
#include "c:\mydir\my.h"  

For include not standart lib file, best way add them in
Project file.
0
 
LVL 1

Author Comment

by:kirthir
ID: 1199652
Thanks for the info, but i am in a different situation altogether here.

Whatever library i am planning to use is an external one which means
i didn't got the source i.e., .cpp, so what i got with me about that library
is .h and .lib files.

Under this scenario....tell me what to do.....
0
 
LVL 2

Expert Comment

by:VEngineer
ID: 1199653
Ok, so if you have the .h files and you have a .lib, you have to do a #include as usual in your program code.

Since you created a console app (I assume you make a project for that) in the project, add your source files as nodes in the project and add the .lib file in the project too as a node.  That should allow it to compile and run properly.

This is a high level view - if you need step by step instructions, let me know.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:kirthir
ID: 1199654
I have a doubt about the inclusion of .h & .lib files as nodes,
because
In options->project->directories, there are paths for standard libraries
for include : C:\bc45\bin
for lib:         C:\bc45\bin
suppose if i copy one of my .h file into the c:\bc45\bin\include directory and if
i included that file in my source code it is compiling perfectly......so my question is why can't it work if it is in another path separated by a semicolon.
WHAT I MEAN TO SAY IS INSTEAD OF COPYING IT TO C:\BC45\BIN\INCLUDE,
I WILL KEEP THE ACTUAL PATH WHERE IT IS LOCATED THAT IS
i want to give the path as c:\bc45\bin; c:\xyz\abc.h

Can you throw some light on this?

Thanks in advance
sharath
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1199655
1. I don't include h files in Project! and recomend you
   don't make it.
2. I don't copy my h files in any BC directory  and
   recomend you don't make it.
3. >>but if h file in other place, best way is
   >>#include "c:\mydir\my.h"  
4. You can use Options|Project|Include field for
  set someting as:
  \bc4\include;c:\myh;c:\myh2
  and in you c/cpp file simple
#include "my.h"
0
 
LVL 2

Expert Comment

by:VEngineer
ID: 1199656
Oops - maybe I wasn't clear before - you only put the .lib files in to the project as nodes, not the .h files.

> i want to give the path as c:\bc45\bin; c:\xyz\abc.h

ok - when you set project options, you don't want to specify the filename, just do the directory name where the header files is shown, so do:

c:\bc45\bin; c:\xyz

instead of what you wrote above.  In the code, then you can do #include "abc.h"
It's the same for the "include" and "lib" paths.  Since you cant do #include "something.lib", you must add the appropriate .lib file as a node in the project (think of a .lib file as coded .cpp files).  So that's how that works.. yes, it's strange, but it's how you do it in Borland.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question