www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Simple I know, but could use some help compiling with make

reply Roderick Gibson <kniteli gmail.com> writes:
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?
Sep 29 2011
next sibling parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 29 Sep 2011 14:23:41 -0400, Roderick Gibson <kniteli 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
Sep 29 2011
parent reply Roderick Gibson <kniteli gmail.com> writes:
On 9/29/2011 11:52 AM, Andrej Mitrovic wrote:
 On 9/29/11, Steven Schveighoffer<schveiguy yahoo.com>  wrote:
 On Thu, 29 Sep 2011 14:32:28 -0400, Andrej Mitrovic
 <andrej.mitrovich gmail.com>  wrote:

 No it's not the same for Windows. On Windows you have to use -L+, e.g.:

 dmd myfile.d -L+path/to/libs mylib.lib

That's because +path/to/libs is the search-path parameter for OPTLINK. -L goes before all linker parameters. The same is for Linux. See here: http://www.digitalmars.com/d/2.0/dmd-windows.html -Steve

Right, I misinterpreted the "same for Windows" part, you were referring to -L and you're right. DMD could do some magic and replace -L-L with -L+ on Windows to simplify cross-platform development. I know it sends everything after -L to the linker, but it could make one special case for this.

Thanks so much guys, it worked, although it looks like a mutated wildebeest. For the interested: IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib all: dmd src/main.d src/display.d src/renderdata.d src/vector2d.d $(IMPORT) $(LIB_PATHS) $(LIB_INCLUDES) Yes, that is TWO backslashes and the empty line between paths and includes is required. Could probably fix it but couldn't figure out how to escape the backslash (to prevent it from escaping the newline).
Sep 29 2011
parent reply Roderick Gibson <kniteli gmail.com> writes:
On 9/29/2011 1:02 PM, Steven Schveighoffer wrote:
 On Thu, 29 Sep 2011 15:28:56 -0400, Roderick Gibson <kniteli gmail.com>
 wrote:

 On 9/29/2011 11:52 AM, Andrej Mitrovic wrote:
 On 9/29/11, Steven Schveighoffer<schveiguy yahoo.com> wrote:
 On Thu, 29 Sep 2011 14:32:28 -0400, Andrej Mitrovic
 <andrej.mitrovich gmail.com> wrote:

 No it's not the same for Windows. On Windows you have to use -L+,
 e.g.:

 dmd myfile.d -L+path/to/libs mylib.lib

That's because +path/to/libs is the search-path parameter for OPTLINK. -L goes before all linker parameters. The same is for Linux. See here: http://www.digitalmars.com/d/2.0/dmd-windows.html -Steve

Right, I misinterpreted the "same for Windows" part, you were referring to -L and you're right. DMD could do some magic and replace -L-L with -L+ on Windows to simplify cross-platform development. I know it sends everything after -L to the linker, but it could make one special case for this.

Thanks so much guys, it worked, although it looks like a mutated wildebeest. For the interested: IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib all: dmd src/main.d src/display.d src/renderdata.d src/vector2d.d $(IMPORT) $(LIB_PATHS) $(LIB_INCLUDES) Yes, that is TWO backslashes and the empty line between paths and includes is required. Could probably fix it but couldn't figure out how to escape the backslash (to prevent it from escaping the newline).

Can you just leave off the last backslash? Again, not too familiar with OPTLINK, so not sure. -Steve

Nope, because then the first backslash would be escaping the newline and the linker looks for Derelict2\lib.lib instead of Derelict2\lib\.
Sep 29 2011
parent Roderick Gibson <kniteli gmail.com> writes:
On 9/29/2011 2:19 PM, Steven Schveighoffer wrote:
 On Thu, 29 Sep 2011 16:30:54 -0400, Roderick Gibson <kniteli gmail.com>
 wrote:

 On 9/29/2011 1:02 PM, Steven Schveighoffer wrote:
 On Thu, 29 Sep 2011 15:28:56 -0400, Roderick Gibson <kniteli gmail.com>
 wrote:

 On 9/29/2011 11:52 AM, Andrej Mitrovic wrote:
 On 9/29/11, Steven Schveighoffer<schveiguy yahoo.com> wrote:
 On Thu, 29 Sep 2011 14:32:28 -0400, Andrej Mitrovic
 <andrej.mitrovich gmail.com> wrote:

 No it's not the same for Windows. On Windows you have to use -L+,
 e.g.:

 dmd myfile.d -L+path/to/libs mylib.lib

That's because +path/to/libs is the search-path parameter for OPTLINK. -L goes before all linker parameters. The same is for Linux. See here: http://www.digitalmars.com/d/2.0/dmd-windows.html -Steve

Right, I misinterpreted the "same for Windows" part, you were referring to -L and you're right. DMD could do some magic and replace -L-L with -L+ on Windows to simplify cross-platform development. I know it sends everything after -L to the linker, but it could make one special case for this.

Thanks so much guys, it worked, although it looks like a mutated wildebeest. For the interested: IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib all: dmd src/main.d src/display.d src/renderdata.d src/vector2d.d $(IMPORT) $(LIB_PATHS) $(LIB_INCLUDES) Yes, that is TWO backslashes and the empty line between paths and includes is required. Could probably fix it but couldn't figure out how to escape the backslash (to prevent it from escaping the newline).

Can you just leave off the last backslash? Again, not too familiar with OPTLINK, so not sure. -Steve

Nope, because then the first backslash would be escaping the newline and the linker looks for Derelict2\lib.lib instead of Derelict2\lib\.

I mean, leave off the, um... first last backslash too :) LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib -Steve

In that case it starts looking for Derelict2\lib.lib instead of Derelict2\lib\
Sep 29 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
No it's not the same for Windows. On Windows you have to use -L+, e.g.:

dmd myfile.d -L+path/to/libs mylib.lib
Sep 29 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Documented here:
http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#PassingsearchdirectoriesforstaticlibraryfilestoOptlink

Damn what a big hashtag, lol.
Sep 29 2011
prev sibling next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 29 Sep 2011 14:32:28 -0400, Andrej Mitrovic  
<andrej.mitrovich gmail.com> wrote:

 No it's not the same for Windows. On Windows you have to use -L+, e.g.:

 dmd myfile.d -L+path/to/libs mylib.lib

That's because +path/to/libs is the search-path parameter for OPTLINK. -L goes before all linker parameters. The same is for Linux. See here: http://www.digitalmars.com/d/2.0/dmd-windows.html -Steve
Sep 29 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 9/29/11, Steven Schveighoffer <schveiguy yahoo.com> wrote:
 On Thu, 29 Sep 2011 14:32:28 -0400, Andrej Mitrovic
 <andrej.mitrovich gmail.com> wrote:

 No it's not the same for Windows. On Windows you have to use -L+, e.g.:

 dmd myfile.d -L+path/to/libs mylib.lib

That's because +path/to/libs is the search-path parameter for OPTLINK. -L goes before all linker parameters. The same is for Linux. See here: http://www.digitalmars.com/d/2.0/dmd-windows.html -Steve

Right, I misinterpreted the "same for Windows" part, you were referring to -L and you're right. DMD could do some magic and replace -L-L with -L+ on Windows to simplify cross-platform development. I know it sends everything after -L to the linker, but it could make one special case for this.
Sep 29 2011
prev sibling next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 29 Sep 2011 15:28:56 -0400, Roderick Gibson <kniteli gmail.com>  
wrote:

 On 9/29/2011 11:52 AM, Andrej Mitrovic wrote:
 On 9/29/11, Steven Schveighoffer<schveiguy yahoo.com>  wrote:
 On Thu, 29 Sep 2011 14:32:28 -0400, Andrej Mitrovic
 <andrej.mitrovich gmail.com>  wrote:

 No it's not the same for Windows. On Windows you have to use -L+,  
 e.g.:

 dmd myfile.d -L+path/to/libs mylib.lib

That's because +path/to/libs is the search-path parameter for OPTLINK. -L goes before all linker parameters. The same is for Linux. See here: http://www.digitalmars.com/d/2.0/dmd-windows.html -Steve

Right, I misinterpreted the "same for Windows" part, you were referring to -L and you're right. DMD could do some magic and replace -L-L with -L+ on Windows to simplify cross-platform development. I know it sends everything after -L to the linker, but it could make one special case for this.

Thanks so much guys, it worked, although it looks like a mutated wildebeest. For the interested: IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib all: dmd src/main.d src/display.d src/renderdata.d src/vector2d.d $(IMPORT) $(LIB_PATHS) $(LIB_INCLUDES) Yes, that is TWO backslashes and the empty line between paths and includes is required. Could probably fix it but couldn't figure out how to escape the backslash (to prevent it from escaping the newline).

Can you just leave off the last backslash? Again, not too familiar with OPTLINK, so not sure. -Steve
Sep 29 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Odd, I never have to do double backslashes. Maybe it's a problem with
make. Personally I just use batch files, I kind of got used to them
for simple projects. For everything else a D script is my handy tool.
Sep 29 2011
prev sibling next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Roderick Gibson" <kniteli gmail.com> wrote in message 
news:j62d4i$1d8l$1 digitalmars.com...
 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?

build.bat: echo off rdmd --build-only -ofmyApp -IC:\Dlang\dmd2\src\ext\Derelict2\import -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib src/main.d Note: 1. After the " echo off", that's supposed to be one line. 2. "rdmd" instead of "dmd" 3. Only one ".d" file is given: The one with main() 4. The ".d" file is the *last* param.
Sep 29 2011
parent reply "Nick Sabalausky" <a a.a> writes:
"Nick Sabalausky" <a a.a> wrote in message 
news:j62msu$205t$1 digitalmars.com...
 "Roderick Gibson" <kniteli gmail.com> wrote in message 
 news:j62d4i$1d8l$1 digitalmars.com...
 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?

build.bat: echo off rdmd --build-only -ofmyApp -IC:\Dlang\dmd2\src\ext\Derelict2\import -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib src/main.d Note: 1. After the " echo off", that's supposed to be one line. 2. "rdmd" instead of "dmd" 3. Only one ".d" file is given: The one with main() 4. The ".d" file is the *last* param.

Or to make it a little cleaner: echo off IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib EXE_NAME = myApp rdmd --build-only -of%EXE_NAME% %IMPORT% %LIB_PATHS% %LIB_INCLUDES% src/main.d Of course, you can use rdmd with make too, but I've never really liked dealing with make.
Sep 29 2011
parent reply Roderick Gibson <kniteli gmail.com> writes:
On 9/29/2011 2:15 PM, Nick Sabalausky wrote:
 "Nick Sabalausky"<a a.a>  wrote in message
 news:j62msu$205t$1 digitalmars.com...
 "Roderick Gibson"<kniteli gmail.com>  wrote in message
 news:j62d4i$1d8l$1 digitalmars.com...
 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?

build.bat: echo off rdmd --build-only -ofmyApp -IC:\Dlang\dmd2\src\ext\Derelict2\import -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib src/main.d Note: 1. After the " echo off", that's supposed to be one line. 2. "rdmd" instead of "dmd" 3. Only one ".d" file is given: The one with main() 4. The ".d" file is the *last* param.

Or to make it a little cleaner: echo off IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib EXE_NAME = myApp rdmd --build-only -of%EXE_NAME% %IMPORT% %LIB_PATHS% %LIB_INCLUDES% src/main.d Of course, you can use rdmd with make too, but I've never really liked dealing with make.

Very cool, thanks for going to all the trouble. It only takes the one souce file, does rdmd build out other files automatically?
Sep 29 2011
parent reply "Nick Sabalausky" <a a.a> writes:
"Roderick Gibson" <kniteli gmail.com> wrote in message 
news:j62nvo$2237$1 digitalmars.com...
 On 9/29/2011 2:15 PM, Nick Sabalausky wrote:
 "Nick Sabalausky"<a a.a>  wrote in message
 news:j62msu$205t$1 digitalmars.com...
 "Roderick Gibson"<kniteli gmail.com>  wrote in message
 news:j62d4i$1d8l$1 digitalmars.com...
 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?

build.bat: echo off rdmd --build-only -ofmyApp -IC:\Dlang\dmd2\src\ext\Derelict2\import -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib src/main.d Note: 1. After the " echo off", that's supposed to be one line. 2. "rdmd" instead of "dmd" 3. Only one ".d" file is given: The one with main() 4. The ".d" file is the *last* param.

Or to make it a little cleaner: echo off IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib EXE_NAME = myApp rdmd --build-only -of%EXE_NAME% %IMPORT% %LIB_PATHS% %LIB_INCLUDES% src/main.d Of course, you can use rdmd with make too, but I've never really liked dealing with make.

Very cool, thanks for going to all the trouble. It only takes the one souce file, does rdmd build out other files automatically?

What rdmd does is takes the file with "main()", figures out all the ".d" files needed, checks if any of them have been changed, and if so, it sends them all to dmd to be compiled. If you omit the "--build-only" it will also run the program you built. The full format for rdmd is: rdmd {params for dmd and rdmd} main.d {params for main.exe} So if you have: //main.d import std.stdio; void main(string[] args) { writeln("Hello", args[1]); } Then you can do this:
 rdmd main.d Joe


It's an awesome tool. You can run just "rdmd" by itself to see all it's options. Be aware though, rdmd has some issues if you're not using at least DMD 2.055.
Sep 29 2011
parent reply Roderick Gibson <kniteli gmail.com> writes:
On 9/29/2011 2:39 PM, Nick Sabalausky wrote:
 "Roderick Gibson"<kniteli gmail.com>  wrote in message
 news:j62nvo$2237$1 digitalmars.com...
 On 9/29/2011 2:15 PM, Nick Sabalausky wrote:
 "Nick Sabalausky"<a a.a>   wrote in message
 news:j62msu$205t$1 digitalmars.com...
 "Roderick Gibson"<kniteli gmail.com>   wrote in message
 news:j62d4i$1d8l$1 digitalmars.com...
 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?

build.bat: echo off rdmd --build-only -ofmyApp -IC:\Dlang\dmd2\src\ext\Derelict2\import -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib src/main.d Note: 1. After the " echo off", that's supposed to be one line. 2. "rdmd" instead of "dmd" 3. Only one ".d" file is given: The one with main() 4. The ".d" file is the *last* param.

Or to make it a little cleaner: echo off IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib EXE_NAME = myApp rdmd --build-only -of%EXE_NAME% %IMPORT% %LIB_PATHS% %LIB_INCLUDES% src/main.d Of course, you can use rdmd with make too, but I've never really liked dealing with make.

Very cool, thanks for going to all the trouble. It only takes the one souce file, does rdmd build out other files automatically?

What rdmd does is takes the file with "main()", figures out all the ".d" files needed, checks if any of them have been changed, and if so, it sends them all to dmd to be compiled. If you omit the "--build-only" it will also run the program you built. The full format for rdmd is: rdmd {params for dmd and rdmd} main.d {params for main.exe} So if you have: //main.d import std.stdio; void main(string[] args) { writeln("Hello", args[1]); } Then you can do this:
 rdmd main.d Joe


It's an awesome tool. You can run just "rdmd" by itself to see all it's options. Be aware though, rdmd has some issues if you're not using at least DMD 2.055.

Hmm, looks like it would be awesome, unfortunately it spits out a bunch of "previous definition different" errors on the linker, in relation to the libraries. Oh well, I seem to be able to get it working with dmd for now.
Sep 29 2011
parent reply Lutger Blijdestijn <lutger.blijdestijn gmail.com> writes:
Roderick Gibson wrote:

... 
 Hmm, looks like it would be awesome, unfortunately it spits out a bunch
 of "previous definition different" errors on the linker, in relation to
 the libraries. Oh well, I seem to be able to get it working with dmd for
 now.

This could be caused by having two 'main' functions in all the modules that rdmd finds.
Oct 01 2011
parent reply Ola Ost <olaa81 gmail.com> writes:
I had exactly this problem too, I asked on the Derelict forums:
http://www.dsource.org/forums/viewtopic.php?t=5856&sid=8ebff671fafec3bd8962ddfceaf99eb8

At the moment I've resolved this by building Derelict with make, first a normal
full
build, then a second run using the cleandi target, which removes the generated
di files.
I've set up the Derelict lib and include paths in dmd's sc.ini file, so I just
have to
call 'rdmd main.d' to build and run.
Oct 05 2011
next sibling parent Roderick Gibson <kniteli gmail.com> writes:
On 10/5/2011 7:46 AM, Ola Ost wrote:
 I had exactly this problem too, I asked on the Derelict forums:
 http://www.dsource.org/forums/viewtopic.php?t=5856&sid=8ebff671fafec3bd8962ddfceaf99eb8

 At the moment I've resolved this by building Derelict with make, first a
normal full
 build, then a second run using the cleandi target, which removes the generated
di files.
 I've set up the Derelict lib and include paths in dmd's sc.ini file, so I just
have to
 call 'rdmd main.d' to build and run.

Hmm, so it's a bug in rdmd trying to compile the .di files or something?
Oct 07 2011
prev sibling parent "Nick Sabalausky" <a a.a> writes:
"Ola Ost" <olaa81 gmail.com> wrote in message 
news:j6hqkh$lk0$1 digitalmars.com...
I had exactly this problem too, I asked on the Derelict forums:
 http://www.dsource.org/forums/viewtopic.php?t=5856&sid=8ebff671fafec3bd8962ddfceaf99eb8

 At the moment I've resolved this by building Derelict with make, first a 
 normal full
 build, then a second run using the cleandi target, which removes the 
 generated di files.
 I've set up the Derelict lib and include paths in dmd's sc.ini file, so I 
 just have to
 call 'rdmd main.d' to build and run.

If someone can make a minimal test case for this issue (ideally no external dependencies), then I'll try my hand at fixing rdmd.
Oct 07 2011
prev sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 29 Sep 2011 16:30:54 -0400, Roderick Gibson <kniteli gmail.com>  
wrote:

 On 9/29/2011 1:02 PM, Steven Schveighoffer wrote:
 On Thu, 29 Sep 2011 15:28:56 -0400, Roderick Gibson <kniteli gmail.com>
 wrote:

 On 9/29/2011 11:52 AM, Andrej Mitrovic wrote:
 On 9/29/11, Steven Schveighoffer<schveiguy yahoo.com> wrote:
 On Thu, 29 Sep 2011 14:32:28 -0400, Andrej Mitrovic
 <andrej.mitrovich gmail.com> wrote:

 No it's not the same for Windows. On Windows you have to use -L+,
 e.g.:

 dmd myfile.d -L+path/to/libs mylib.lib

That's because +path/to/libs is the search-path parameter for OPTLINK. -L goes before all linker parameters. The same is for Linux. See here: http://www.digitalmars.com/d/2.0/dmd-windows.html -Steve

Right, I misinterpreted the "same for Windows" part, you were referring to -L and you're right. DMD could do some magic and replace -L-L with -L+ on Windows to simplify cross-platform development. I know it sends everything after -L to the linker, but it could make one special case for this.

Thanks so much guys, it worked, although it looks like a mutated wildebeest. For the interested: IMPORT = -IC:\Dlang\dmd2\src\ext\Derelict2\import LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib\\ LIB_INCLUDES = DerelictSDL.lib DerelictGL.lib DerelictUtil.lib DerelictGLU.lib all: dmd src/main.d src/display.d src/renderdata.d src/vector2d.d $(IMPORT) $(LIB_PATHS) $(LIB_INCLUDES) Yes, that is TWO backslashes and the empty line between paths and includes is required. Could probably fix it but couldn't figure out how to escape the backslash (to prevent it from escaping the newline).

Can you just leave off the last backslash? Again, not too familiar with OPTLINK, so not sure. -Steve

Nope, because then the first backslash would be escaping the newline and the linker looks for Derelict2\lib.lib instead of Derelict2\lib\.

I mean, leave off the, um... first last backslash too :) LIB_PATHS = -L+C:\Dlang\dmd2\src\ext\Derelict2\lib -Steve
Sep 29 2011