www.digitalmars.com         C & C++   DMDScript  

c++ - Newbie DMC++ question: Linking

reply Tod <tk1986be gmail.com> writes:
Dear experts,
I am still learning c++ and I have chosen dmc because it looks simple enough
for me (I don't want to learn how to use a fancy IDE yet).

I managed to get into classes and now I am practicing the splitting
of files. I have my hello.cpp, which includes a class chocolate.h (that file
includes only prototypes), which has its member functions defined in a file
called chocolate.cpp.

I don't know how to link the three files into one executable.
Please give me step-by-step instructions of the most simple way to do it. I
noticed the compiler will find chocolate.h when it's in the same folder as
hello.cpp but I don't know how to link the chocolate.obj (generated from
chocolate.cpp, with a "no start address" warning) with the hello.obj.

Thanks!
Aug 15 2009
next sibling parent Bertel Brander <bertel post4.tele.dk> writes:
Tod skrev:
 Dear experts,
 I am still learning c++ and I have chosen dmc because it looks simple enough
 for me (I don't want to learn how to use a fancy IDE yet).
 
 I managed to get into classes and now I am practicing the splitting
 of files. I have my hello.cpp, which includes a class chocolate.h (that file
 includes only prototypes), which has its member functions defined in a file
 called chocolate.cpp.
 
 I don't know how to link the three files into one executable.
 Please give me step-by-step instructions of the most simple way to do it. I
 noticed the compiler will find chocolate.h when it's in the same folder as
 hello.cpp but I don't know how to link the chocolate.obj (generated from
 chocolate.cpp, with a "no start address" warning) with the hello.obj.

Have a look at: http://damb.dk/multifile.php
Aug 15 2009
prev sibling parent Walter Bright <newshound1 digitalmars.com> writes:
To link a file:

   dmc file.obj

To link multiple files together:

   dmc file1.obj file2.obj file3.obj
Aug 30 2009