Jump to page: 1 2
Thread overview
Compiler import path
Oct 04, 2005
John C
Oct 04, 2005
Lars Ivar Igesund
Oct 04, 2005
John C
Oct 04, 2005
Lars Ivar Igesund
Oct 04, 2005
John C
Oct 04, 2005
J C Calvarese
Oct 04, 2005
John C
Oct 04, 2005
Derek Parnell
Oct 04, 2005
Derek Parnell
Oct 04, 2005
John C
Oct 04, 2005
John C
Oct 04, 2005
Charles
Oct 05, 2005
J C Calvarese
Oct 04, 2005
Lars Ivar Igesund
October 04, 2005
I've never been able to get the D compiler to recognise my additions to the import path, either in sc.ini or on the command line (via batch files). I've searched the newsgroups to no avail. Anyone see what I'm doing wrong? This is for Windows XP, by the way.

    dmd -IC:\Projects\test main.d

    dmd -I"C:\Projects\test" main.d

    dmd "-IC:\Projects\test" main.d

All result in this error:
    main.d: module main cannot read file 'main.d'

main.d has a valid module declaration. It compiles if I cd to C:\Projects\test first. But I'd like to find out the correct format for the import path so I can use multiple libraries, which may be in disparate directories.

Thanks.


October 04, 2005
The import path is for the files imported by the files you compile. That is if you import anything non-phobos from main.d, and it lies somewhere else, you need to provide an importpath.

I think your first format in your post is correct for the import path. Your problem is that main.d isn't an imported file, and thus you must do this:

dmd C:\Projects\test\main.d

to compile that file.

Lars Ivar Igesund

John C wrote:

> I've never been able to get the D compiler to recognise my additions to the import path, either in sc.ini or on the command line (via batch files). I've searched the newsgroups to no avail. Anyone see what I'm doing wrong? This is for Windows XP, by the way.
> 
>     dmd -IC:\Projects\test main.d
> 
>     dmd -I"C:\Projects\test" main.d
> 
>     dmd "-IC:\Projects\test" main.d
> 
> All result in this error:
>     main.d: module main cannot read file 'main.d'
> 
> main.d has a valid module declaration. It compiles if I cd to C:\Projects\test first. But I'd like to find out the correct format for the import path so I can use multiple libraries, which may be in disparate directories.
> 
> Thanks.

October 04, 2005
"Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtnl3$13cb$1@digitaldaemon.com...
> The import path is for the files imported by the files you compile. That
> is
> if you import anything non-phobos from main.d, and it lies somewhere else,
> you need to provide an importpath.
>
> I think your first format in your post is correct for the import path.
> Your
> problem is that main.d isn't an imported file, and thus you must do this:
>
> dmd C:\Projects\test\main.d
>
> to compile that file.

You're right in this instance, but the problem still stands. If I attempt to import other modules on my import path, the compiler tells me it can't read that module.

So this:

    dmd -IC:\Projects\test C:\Projects\test\main.d example.d

fails when example.d is in C:\Projects\test and main imports example.

>
> Lars Ivar Igesund
>
> John C wrote:
>
>> I've never been able to get the D compiler to recognise my additions to the import path, either in sc.ini or on the command line (via batch files). I've searched the newsgroups to no avail. Anyone see what I'm doing wrong? This is for Windows XP, by the way.
>>
>>     dmd -IC:\Projects\test main.d
>>
>>     dmd -I"C:\Projects\test" main.d
>>
>>     dmd "-IC:\Projects\test" main.d
>>
>> All result in this error:
>>     main.d: module main cannot read file 'main.d'
>>
>> main.d has a valid module declaration. It compiles if I cd to
>> C:\Projects\test first. But I'd like to find out the correct format for
>> the import path so I can use multiple libraries, which may be in
>> disparate
>> directories.
>>
>> Thanks.
> 


October 04, 2005
Yes, but your command line below also compiles example.d. If you want to only import it in main.d, that is there is no code to be linked in, just symbols, don't put example.d on the command line at all. If both files must be compiled and linked in, you must do this

dmd C:\Projects\test\main.d C:\Projects\test\example.d

:)

Lars Ivar Igesund


John C wrote:

> "Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtnl3$13cb$1@digitaldaemon.com...
>> The import path is for the files imported by the files you compile. That
>> is
>> if you import anything non-phobos from main.d, and it lies somewhere
>> else, you need to provide an importpath.
>>
>> I think your first format in your post is correct for the import path.
>> Your
>> problem is that main.d isn't an imported file, and thus you must do this:
>>
>> dmd C:\Projects\test\main.d
>>
>> to compile that file.
> 
> You're right in this instance, but the problem still stands. If I attempt to import other modules on my import path, the compiler tells me it can't read that module.
> 
> So this:
> 
>     dmd -IC:\Projects\test C:\Projects\test\main.d example.d
> 
> fails when example.d is in C:\Projects\test and main imports example.
> 
>>
>> Lars Ivar Igesund
>>
>> John C wrote:
>>
>>> I've never been able to get the D compiler to recognise my additions to the import path, either in sc.ini or on the command line (via batch files). I've searched the newsgroups to no avail. Anyone see what I'm doing wrong? This is for Windows XP, by the way.
>>>
>>>     dmd -IC:\Projects\test main.d
>>>
>>>     dmd -I"C:\Projects\test" main.d
>>>
>>>     dmd "-IC:\Projects\test" main.d
>>>
>>> All result in this error:
>>>     main.d: module main cannot read file 'main.d'
>>>
>>> main.d has a valid module declaration. It compiles if I cd to
>>> C:\Projects\test first. But I'd like to find out the correct format for
>>> the import path so I can use multiple libraries, which may be in
>>> disparate
>>> directories.
>>>
>>> Thanks.
>>

October 04, 2005
"Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtrpf$167r$1@digitaldaemon.com...
> Yes, but your command line below also compiles example.d. If you want to
> only import it in main.d, that is there is no code to be linked in, just
> symbols, don't put example.d on the command line at all. If both files
> must
> be compiled and linked in, you must do this
>
> dmd C:\Projects\test\main.d C:\Projects\test\example.d

Thanks for pointing that out, Lars. I hadn't realised.

So, if -I is only appropriate for importing symbols, then I reckon it needs another option to specify where to look for code modules, or allow -I to do that too. My command line is getting ridiculously long...

John.

>
> :)
>
> Lars Ivar Igesund
>
>
> John C wrote:
>
>> "Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtnl3$13cb$1@digitaldaemon.com...
>>> The import path is for the files imported by the files you compile. That
>>> is
>>> if you import anything non-phobos from main.d, and it lies somewhere
>>> else, you need to provide an importpath.
>>>
>>> I think your first format in your post is correct for the import path.
>>> Your
>>> problem is that main.d isn't an imported file, and thus you must do
>>> this:
>>>
>>> dmd C:\Projects\test\main.d
>>>
>>> to compile that file.
>>
>> You're right in this instance, but the problem still stands. If I attempt to import other modules on my import path, the compiler tells me it can't read that module.
>>
>> So this:
>>
>>     dmd -IC:\Projects\test C:\Projects\test\main.d example.d
>>
>> fails when example.d is in C:\Projects\test and main imports example.
>>
>>>
>>> Lars Ivar Igesund
>>>
>>> John C wrote:
>>>
>>>> I've never been able to get the D compiler to recognise my additions to the import path, either in sc.ini or on the command line (via batch files). I've searched the newsgroups to no avail. Anyone see what I'm doing wrong? This is for Windows XP, by the way.
>>>>
>>>>     dmd -IC:\Projects\test main.d
>>>>
>>>>     dmd -I"C:\Projects\test" main.d
>>>>
>>>>     dmd "-IC:\Projects\test" main.d
>>>>
>>>> All result in this error:
>>>>     main.d: module main cannot read file 'main.d'
>>>>
>>>> main.d has a valid module declaration. It compiles if I cd to
>>>> C:\Projects\test first. But I'd like to find out the correct format for
>>>> the import path so I can use multiple libraries, which may be in
>>>> disparate
>>>> directories.
>>>>
>>>> Thanks.
>>>
> 


October 04, 2005
In article <dhtsvk$18c2$1@digitaldaemon.com>, John C says...
>
>"Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtrpf$167r$1@digitaldaemon.com...
>> Yes, but your command line below also compiles example.d. If you want to
>> only import it in main.d, that is there is no code to be linked in, just
>> symbols, don't put example.d on the command line at all. If both files
>> must
>> be compiled and linked in, you must do this
>>
>> dmd C:\Projects\test\main.d C:\Projects\test\example.d
>
>Thanks for pointing that out, Lars. I hadn't realised.
>
>So, if -I is only appropriate for importing symbols, then I reckon it needs another option to specify where to look for code modules, or allow -I to do that too. My command line is getting ridiculously long...
>
>John.

Have you tried?

c:
cd \project\test
dmd main.d example.d

(This method requires dmd to be in your path, but I think it's worth the
effort.)

Alternatively, you migtht try using Build
(http://www.dsource.org/projects/build/).

jcc7
October 04, 2005
Try Derek Parnell's build utility, look at www.dsource.org.

Lars Ivar Igesund


John C wrote:

> "Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtrpf$167r$1@digitaldaemon.com...
>> Yes, but your command line below also compiles example.d. If you want to
>> only import it in main.d, that is there is no code to be linked in, just
>> symbols, don't put example.d on the command line at all. If both files
>> must
>> be compiled and linked in, you must do this
>>
>> dmd C:\Projects\test\main.d C:\Projects\test\example.d
> 
> Thanks for pointing that out, Lars. I hadn't realised.
> 
> So, if -I is only appropriate for importing symbols, then I reckon it needs another option to specify where to look for code modules, or allow -I to do that too. My command line is getting ridiculously long...
> 
> John.
> 
>>
>> :)
>>
>> Lars Ivar Igesund
>>
>>
>> John C wrote:
>>
>>> "Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtnl3$13cb$1@digitaldaemon.com...
>>>> The import path is for the files imported by the files you compile.
>>>> That is
>>>> if you import anything non-phobos from main.d, and it lies somewhere
>>>> else, you need to provide an importpath.
>>>>
>>>> I think your first format in your post is correct for the import path.
>>>> Your
>>>> problem is that main.d isn't an imported file, and thus you must do
>>>> this:
>>>>
>>>> dmd C:\Projects\test\main.d
>>>>
>>>> to compile that file.
>>>
>>> You're right in this instance, but the problem still stands. If I attempt to import other modules on my import path, the compiler tells me it can't read that module.
>>>
>>> So this:
>>>
>>>     dmd -IC:\Projects\test C:\Projects\test\main.d example.d
>>>
>>> fails when example.d is in C:\Projects\test and main imports example.
>>>
>>>>
>>>> Lars Ivar Igesund
>>>>
>>>> John C wrote:
>>>>
>>>>> I've never been able to get the D compiler to recognise my additions to the import path, either in sc.ini or on the command line (via batch files). I've searched the newsgroups to no avail. Anyone see what I'm doing wrong? This is for Windows XP, by the way.
>>>>>
>>>>>     dmd -IC:\Projects\test main.d
>>>>>
>>>>>     dmd -I"C:\Projects\test" main.d
>>>>>
>>>>>     dmd "-IC:\Projects\test" main.d
>>>>>
>>>>> All result in this error:
>>>>>     main.d: module main cannot read file 'main.d'
>>>>>
>>>>> main.d has a valid module declaration. It compiles if I cd to
>>>>> C:\Projects\test first. But I'd like to find out the correct format
>>>>> for the import path so I can use multiple libraries, which may be in
>>>>> disparate
>>>>> directories.
>>>>>
>>>>> Thanks.
>>>>
>>

October 04, 2005
"J C Calvarese" <technocrat7@gmail.com> wrote in message news:dhttm5$199q$1@digitaldaemon.com...
> In article <dhtsvk$18c2$1@digitaldaemon.com>, John C says...
>>
>>"Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtrpf$167r$1@digitaldaemon.com...
>>> Yes, but your command line below also compiles example.d. If you want to
>>> only import it in main.d, that is there is no code to be linked in, just
>>> symbols, don't put example.d on the command line at all. If both files
>>> must
>>> be compiled and linked in, you must do this
>>>
>>> dmd C:\Projects\test\main.d C:\Projects\test\example.d
>>
>>Thanks for pointing that out, Lars. I hadn't realised.
>>
>>So, if -I is only appropriate for importing symbols, then I reckon it
>>needs
>>another option to specify where to look for code modules, or allow -I to
>>do
>>that too. My command line is getting ridiculously long...
>>
>>John.
>
> Have you tried?
>
> c:
> cd \project\test
> dmd main.d example.d

Yes, that's what I've been doing till now. But this will only work for files in the current directory. If I've got files elsewhere (say, C:\AnotherProjectFolder), I need to specify the absolute path.

What's worse, DMD doesn't seem to like spaces in paths, even if I use quotes, which is so 1994.

Anyone know if the various D build tools supports both of these? Also, C#-style response-file support would be nice.

>
> (This method requires dmd to be in your path, but I think it's worth the
> effort.)
>
> Alternatively, you migtht try using Build
> (http://www.dsource.org/projects/build/).
>
> jcc7


October 04, 2005
On Tue, 4 Oct 2005 14:06:32 +0100, John C wrote:

> "J C Calvarese" <technocrat7@gmail.com> wrote in message news:dhttm5$199q$1@digitaldaemon.com...
>> In article <dhtsvk$18c2$1@digitaldaemon.com>, John C says...
>>>
>>>"Lars Ivar Igesund" <larsivar@igesund.net> wrote in message news:dhtrpf$167r$1@digitaldaemon.com...
>>>> Yes, but your command line below also compiles example.d. If you want to
>>>> only import it in main.d, that is there is no code to be linked in, just
>>>> symbols, don't put example.d on the command line at all. If both files
>>>> must
>>>> be compiled and linked in, you must do this
>>>>
>>>> dmd C:\Projects\test\main.d C:\Projects\test\example.d
>>>
>>>Thanks for pointing that out, Lars. I hadn't realised.
>>>
>>>So, if -I is only appropriate for importing symbols, then I reckon it
>>>needs
>>>another option to specify where to look for code modules, or allow -I to
>>>do
>>>that too. My command line is getting ridiculously long...
>>>
>>>John.
>>
>> Have you tried?
>>
>> c:
>> cd \project\test
>> dmd main.d example.d
> 
> Yes, that's what I've been doing till now. But this will only work for files in the current directory. If I've got files elsewhere (say, C:\AnotherProjectFolder), I need to specify the absolute path.
> 
> What's worse, DMD doesn't seem to like spaces in paths, even if I use quotes, which is so 1994.

Actually, the D compiler does support spaces in the path, but the linker doesn't. The net result is you're still screwed. Walter has stated many times that the linker is not going to be updated.

> Anyone know if the various D build tools supports both of these?

If I'm reading you correctly, you want to say (for instance) ...

   build main.d example.d

and the utility will some how know where on your disk(s) that you have stored these files, right? Maybe if you'd accept a compromise ... what if you give the utility a list of potential areas you that these files might exist, kind like a PATH symbol, and it searches through these. Now that feature I can easily put into Build if you want.

> Also, C#-style response-file support would be nice.

I don't know what that is. Can you point me to a specification etc...?

-- 
Derek Parnell
Melbourne, Australia
4/10/2005 11:25:48 PM
October 04, 2005
On Tue, 4 Oct 2005 23:33:01 +1000, Derek Parnell wrote:


>> Also, C#-style response-file support would be nice.
> 
> I don't know what that is. Can you point me to a specification etc...?

Don't bother, I found it myself.

The Build utility already supports the idea of response files. For example you can have a file called 'xyz.brf' that contains

  main.d
  example.d
  -unittest
  -w

and use it thus ...

  build @xyz

You can have as many response file specification on the command line as you like. The '.brf' is the default extention but you can use anything.

Build also supports another sort of response file. In this case the run time options are stored in the Build Configuration file and are used primarily for often used combinations of command line switches. For example, your configuration file (build.cfg) might look like this ...

 CMDLINE=-info           # Show the version of build
 CMDLINE=-Iz:\dlibs

 [dbg]
 CMDLINE=-unittest --release --inline -g -w -full
 CMDLINE=-T{Target}_{Group}

 [prod]
 CMDLINE=--unittest --debug* --g --w -release -inline -full
 CMDLINE=-T{Target}_{Group}

and you use it thus ...

  build main.d +dbg

in which case, all the CMDLINE options in the unnamed section are used plus the ones in the [dbg] section. The {Target} would get replaced with 'main' because that's the file used on the command line, and {Group} would get replaced with 'dbg' because that's the section that was specified. This would make the string '-Tmain_dbg' appear on the dmd command line.

You can mix'n'match the two response file usages on the same command line.

To get the debug edition ...
  build @xyz +dbg

To get the production edition ...
  build @xyz +prod

-- 
Derek Parnell
Melbourne, Australia
4/10/2005 11:45:23 PM
« First   ‹ Prev
1 2