writing a library

A

amit

Hi all,

I'm going to write a library for the first time. Can you please drop me
some links or any advice you may have?

Thanks
Amit
 
J

Jason

amit said:
Hi all,

I'm going to write a library for the first time. Can you please drop me
some links or any advice you may have?

In it's simplest form, a library is simply a *.cpp and a *.h file that
you include with your other files. The *.h file gets included along
with all the other headers and the *.cpp file gets linked to your code.

-Jason
 
J

Jason

Jason said:
The *.h file gets included along
with all the other headers and the *.cpp file gets linked to your
code.

Er, the *.cpp file gets _compiled_ into your executable. I was a bit
lazy in my choice of words.
 
A

amit

I mean, the library I'm going to write would be big since I need to add
hundered of line (func and class).
Should I put them in one CPP file or can have multiple .cpp and .h
files?
 
J

Jesper Madsen

amit said:
I mean, the library I'm going to write would be big since I need to add
hundered of line (func and class).
Should I put them in one CPP file or can have multiple .cpp and .h
files?
You should definately group you classes and or functions in different
files!! (.cpp & .h)
 
K

Karl Heinz Buchegger

amit said:
I mean, the library I'm going to write would be big since I need to add
hundered of line (func and class).
Should I put them in one CPP file or can have multiple .cpp and .h
files?

You could do the further or the later or you could search your toolkit
if it contains a 'librarian'. Most systems come with one (I don't know
any that doesn't). The librarian organizes multiple compiled files in
a library. You then just link the executable with that library.

The above sounds more complicated then it really is.
 

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
474,202
Messages
2,571,057
Members
47,665
Latest member
salkete

Latest Threads

Top