Re: brand newbie function libraries
From: B. v Ingen Schenau (bart_at_ingen.ddns.info)
Date: Mon, 31 Jan 2005 19:55:13 +0100
Please don't top post. Put your own contributions after the material you
are responding to.
john smith wrote:
> "Mike Wahler" <email@example.com> wrote in message
>> "john smith" <firstname.lastname@example.org> wrote in message
>>> I'm trying to work out how to create a simple function library.
>>> I'm using Dev-C++ IDE. on winxp.
>>> Anyone know how I do this with Mingw port of GCC? I'm pretty sure
>>> I've added here are correct. Can anyone help?
>> Sorry, but not here. Here we only discuss the standard
>> C and C++ languages. Building libraries is outside the
>> scope of the languages, and each development product
>> will have its own way of doing it. Check support
>> resources (e.g. web sites, mailing lists, newsgroups, etc.)
>> dedicated to your particular product(s).
>> BTW your code looks fine.
>> Purpose of alt.comp.lang.learn.c-c++:
> Is what I'm trying to do the way you create organise a C++ program. I
> I can sucsessfully put all my functions in one file with main(). But
> I'm guessing it would get messy as things get bigger.
You are guessing right.
> In general, would a program consist of a main file with the main()
> function and multiple other files for different functions and classes?
> If so, are these external functions and classes compiled differently
> on different compilers?
They are not exactly compiled differently, but you have to tell the
compiler somehow that your project consist of the files a.c, b.c and
main.c, but that z.cpp is completely unrelated to your current project.
When you are using a command-line compiler (and you have a small number
of files) you can typically list all the files on the command-line and
the compiler will combine them all after compilation into one
When you have a larger number of files in your project, the traditional
way of managing them is by using something called a 'makefile', and a
utility called 'make'.
Most (reasonably) modern IDE's will have a facility to manage a project.
When you add files to such a project, the IDE will tell the compiler
that all those files belong together.
To find out if your IDE can manage projects, and to get the most out of
it, you can best turn to a support-group for your IDE. That is where
you will find the experts on that subject.
> Hope this makes sence.
> now... to read that massive faq
After you have read it, bookmark it. Then you can easily come back when
new questions arise.
Bart v Ingen Schenau
-- a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq c.l.c FAQ: http://www.eskimo.com/~scs/C-faq/top.html c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/