D - imports
- radon7 (4/4) Apr 16 2010 Hello. How do you import a file that is in an adjacent folder that you w...
- Robert Clipsham (10/14) Apr 16 2010 This newsgroup isn't in use any more, see
- Dan McLeran (10/10) Sep 01 2010 I have had this problem. The way I solved it was to pass the -I flag to ...
Hello. How do you import a file that is in an adjacent folder that you wrote yourself, C's equivalent to #include "../folder/file"? I can get import to work for files in the same directory but not anything in higher or adjacent directories.
Apr 16 2010
On 16/04/10 17:35, radon7 wrote:Hello. How do you import a file that is in an adjacent folder that you wrote yourself, C's equivalent to #include "../folder/file"? I can get import to work for files in the same directory but not anything in higher or adjacent directories.This newsgroup isn't in use any more, see http://www.digitalmars.com/NewsGroup.html for a list of up-to-date newsgroups, this post belongs on digitalmars.D.learn :) In answer to your question, you use: ---- import folder.file; ---- Make sure to add -I../ to your command line when compiling if folder is in a parent directory :)
Apr 16 2010
I have had this problem. The way I solved it was to pass the -I flag to the compiler and pass in the path of the root-most dir of my source tree. If my source tree looked like: c:\code\d\test c:\code\d\test\sub1 c:\code\d\test\sub2 and a module in sub2 needed to import a module in sub1: import sub1.somemod; I would pass the compiler: dmd -c -Ic:\code\d\test
Sep 01 2010