Simple I know, but could use some help compiling with make

Steven Schveighoffer schveiguy at yahoo.com
Thu Sep 29 11:29:15 PDT 2011


On Thu, 29 Sep 2011 14:23:41 -0400, Roderick Gibson <kniteli at gmail.com>  
wrote:

> It's my first foray into the arcana of makefiles and command line  
> compiling.
>
> My makefile looks like this:
>
> IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import
> LIB_PATHS = -LC:\Dlang\dmd2\src\ext\Derelict2\lib
> LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib
>
> all:
> 	dmd src/main.d src/display.d src/renderdata.d src/vector2d.d\
> 	$(IMPORT) $(LIB_PATHS) $(LIB_INCLUDES)
>
> I think I just don't know how to give the compiler what it wants. I can  
> build it manually by simply including the full paths to each of those  
> libraries, but I'd rather avoid having to do that unless necessary. Is  
> there something I'm just missing?

Library options start with -L.  dmd passes everything after the -L to the  
linker.

What you need to do (I am making a vague guess that you are on windows :)   
is look up OPTLINK's command line options, then use those options after -L.

As one who does not do much on Windows, I can tell you that it's very odd  
when doing dmd commands on Linux, for example:

dmd myfile.d -L-Lpath/to/libs -L-lmylib

Note the extra -L prefixes are needed, the same is for Windows.

-Steve


More information about the Digitalmars-d-learn mailing list