D - more or less power than C++?

Johan Granberg lijat.meREM at OVEgmail.com
Sat Mar 4 07:06:09 PST 2006


Derek Parnell wrote:
>> 2. as far as I know no way of inporting somthing in a parent directory 
>> (as C++ #include "../myheader.hpp")
> 
> You can, only its not coded in the source file. Instead you do this via 
> the compiler's "-I" switch.
> 

Yes it can bee worked around but it's frustrating to have to add a lot 
of -I by hand to the compiler. It realy complicates keeping a simple 
makefile.

An example.

foo/bar/ff.d
foo/gg.d
rr.d

gg.d imports ff.d with the command import bar.ff;
rr.d imports gg.d using import foo.d; but now you cant just compile rr.d 
because the compiler does not find ff.d.

I realise that my orgina formulation was not so clear. actualy it is not 
specificaly import from parent dir I want but import relative to the 
source files dir instead of the dir where the compiler is invoked.

consider the diference of thees c++ includes

#include "foo.h" // includes relative to the sourcefiles dir and if that 
fails in the current path

#include <foo.h> //includes from path

and D's import

import foo; // imports from the search path with the compiler flag -I. added

wath I want is somthing like the first c++ statement ie an include 
relative to the sourcefiles location.



More information about the Digitalmars-d mailing list