help using dmd on linux
John Reimer
terminal.node at gmail.com
Thu Dec 21 22:56:53 PST 2006
On Thu, 21 Dec 2006 18:55:06 -0800, Bill Baxter
<dnewsgroup at billbaxter.com> wrote:
> I'm trying out D on Linux for the first time and am having trouble
> linking a program with extra library dependencies.
>
> This should be simple for anyone who has compiled on Linux before.
>
> Namely I'm trying to compile the sdl example in the Derelict examples
> directory.
>
> Here's the type of compile command I've tried to use:
>
> $ bud sdl_ex1.d -I../DerelictSDL -I../DerelictUtil -L-L../lib
> ..lib/libDerelictSDL.a ../lib/libDerelictUtil.a
>
> And various variations on that. But I keep getting a few pages errors
> like:
>
> gcc: /[path]/Derelict/DerelictSDL/derelict/sdl/sdl.o: No such file or
> directory
>
>
> Am I just not passing the -L../lib parameter right?
>
> --bb
Two things I can think of:
1) If you use bud, it will compile all necessary files. No need to link
with any libraries. Bud recurses the Derelict directories (as inferred
from the import statements in your module), and manages the compiling and
linking of the individual modules needed for the build. So you can remove
all the library commands line args. An include directory to the derelict
path will still be necessary.
2) You probably have to pass the "-op" flag to dmd which makes sure that
object files stay put in the same directory as the source. By default all
object files get stored in the working directory which can cause annoying
problems later when gcc thinks they should be in the source directory. So
try adding "-op" to your commandline.
-JJR
More information about the Digitalmars-d-learn
mailing list