www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Total Newbie Q regarding compiling..

reply "Chris Warwick" <sp m.me.not> writes:
I've only ever used integrated IDEs before so im a bit bemused as to how i 
get multiple source files to compile into a single exe. I tried dmd + 
sourcefilename but that always gives me an exe. I have the compiler instaled 
ok, and i can compile a basic program, if it's just in a single file, do i 
need a make file or a linker doing somthing or other to build multifile 
projects??

thanks,

chris 
Mar 07 2007
next sibling parent reply Daniel Keep <daniel.keep.lists gmail.com> writes:
Chris Warwick wrote:
 I've only ever used integrated IDEs before so im a bit bemused as to how i 
 get multiple source files to compile into a single exe. I tried dmd + 
 sourcefilename but that always gives me an exe. I have the compiler instaled 
 ok, and i can compile a basic program, if it's just in a single file, do i 
 need a make file or a linker doing somthing or other to build multifile 
 projects??
 
 thanks,
 
 chris 

a.d: ---- import b; void main() { hi(); } b.d: ---- import std.stdio; void hi() { writefln("Heeeeere's Johnny!"); } Then compile and run like so:
 dmd a.d b.d
 a

There are also several tools that will simplify this for you. The most used seem to be bud (www.dsource.org/projects/build) and rebuild (http://www.dsource.org/projects/dsss/wiki/Rebuild). -- Daniel -- Unlike Knuth, I have neither proven or tried the above; it may not even make sense. v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Mar 07 2007
parent reply "Chris Warwick" <sp m.me.not> writes:
"Daniel Keep" <daniel.keep.lists gmail.com> wrote in message 
news:esnu0j$1fah$3 digitalmars.com...
 Then compile and run like so:

 dmd a.d b.d


So the first file listsed becomes the exe? The second just an object file? And dmd automaticly links them?
 a

There are also several tools that will simplify this for you. The most used seem to be bud (www.dsource.org/projects/build) and rebuild (http://www.dsource.org/projects/dsss/wiki/Rebuild).

Great, bud looks just the thing for me. ;-)
Mar 07 2007
parent Daniel Keep <daniel.keep.lists gmail.com> writes:
Chris Warwick wrote:
 "Daniel Keep" <daniel.keep.lists gmail.com> wrote in message 
 news:esnu0j$1fah$3 digitalmars.com...
 Then compile and run like so:

 dmd a.d b.d


So the first file listsed becomes the exe? The second just an object file? And dmd automaticly links them?

Each source or object file you supply to dmd gets linked into the final output. The default output filename is derived from the first file you pass to it. In this case, it produces an executable because one of those source files has a "main" function in it. If you omit the main function, you get a library. You can also override what the output file is called as well as what *kind* out output is created with various compiler switches; can't think of them off the top of my head. Just run 'dmd' with no arguments for a list.
 a

There are also several tools that will simplify this for you. The most used seem to be bud (www.dsource.org/projects/build) and rebuild (http://www.dsource.org/projects/dsss/wiki/Rebuild).

Great, bud looks just the thing for me. ;-)

There are also a growing number of IDEs that support D. Off the top of my head, there's Code::Blocks and Descent. There's a list of D support for editors you can look at here: http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport An IDE is nice, but it never hurts to understand what's going on under all those shiny buttons :) -- Daniel -- Unlike Knuth, I have neither proven or tried the above; it may not even make sense. v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Mar 07 2007
prev sibling parent Dejan Lekic <dejan.lekic gmail.com> writes:
Mr. Warwick, you can still use IDEs if that is what You prefer, allthough I
really recommend learning basics of building a native applications (ie. basic
of compiling and linking processes).

http://www.codeblocks.org is the IDE I use for C/C++/D programming, which I
warmly recommend.
There is an in-development IDE called eDitor as well. I do not remember the
URI, but You can just search for it here, and You'll find it. :)

Kind regards

Dejan
Mar 08 2007