On Saturday, 22 October 2016 at 03:59:16 UTC, Jason C. Wells
wrote:
First, thank you for taking the time to help me with something
that should be trivial.
I've done the above listing of file on the command line but I'm
still stuck. I'm starting to think that I might actually be
tripping over bugs, but I'm not confident enough to believe
that without some confirmation.
I think I can confidently assure you that you aren't running into
any bugs here.
I have the following directory structure from the zipfiles
found in the repositories posted by ketmar.
nanovg_demo
- iv (was renamed from nanovg based on dmd error messages)
-- arsd (was renamed from arsd-master based on dmd error
messages)
To proceed, I would attempt a compile. Then I would add the
file that was producing an error to the command line and try
again. I got this far.
Via cmd.exe:
nanovg_demo>dmd example.d iv\arsd\color.d
iv\arsd\simpledisplay.d iv\perf.d
iv\perf.d(41): Error: module iv.nanovg.nanovg from file
iv\nanovg.d must be
imported with 'import iv.nanovg.nanovg;'
demo.d(6): Error: module iv.nanovg.nanovg from file
iv\nanovg.d must be
imported with 'import iv.nanovg.nanovg;'
iv/nanovg/nanovg does not exist in the source code zip files.
(I was reluctant to duplicate nanonvg into iv\nanovg because
somewhere I learned that copy-pasting code is a bad idea.)
looking at kemar's repository, the nanovg.d module belongs to the
iv.nanovg package. I don't know what the zip directory tree looks
like, but you should have this:
- iv
-- nanovg
--- fui
--- nanovg.d
--- oui
--- package.d
--- perf.d
--- svg.d
As for the asrd stuff, it shouldn't bee in the iv tree at all.
You should do something like this:
- import
-- iv
-- arsd
Both iv and arsd are top-level packages, so they ought to be
independent of each other.
demo.d(7): Error: module oui is in file 'iv\nanovg\oui.d'
which cannot be read
oui.d does not exist anywhere. There is, however, a oui
directory.
If you look at the source for demo.d, you'll see that it makes
use of the oui package. That means the everything there also
needs to be compiled and linked into the binary, but you haven't
given those files to the compiler.
As a side note, I did have some success. I am able to compile
nanovg.lib quite easily (from tips provided a few messages
ago). It's when I try to compile the demo that I get stuck.
Which files did you add into nanovg.lib? Everything in the
iv.nanovg packages and subpackages, or just the ones you use
directly? It's best to compile all of them into the lib, then any
that are used indirectly by each other are also available.
You've dived right into a multi-module projects without a full
understanding of imports and linking. I suggest you back up a bit
and get familiar with the process before tackling ketmar and
Adam's stuff. If they used dub, it would be a very easy process.
Since they don't, and you have to manage it all manually, you
need a solid understanding of how DMD handles this stuff and why
you are getting the error messages you see.
Try playing around with simple single-function modules, starting
with something like this:
io.d:
```
void print(string s)
{
import std.stdio : writeln;
writeln(s);
}
```
main.d:
```
import io;
void main() { print("Hello, D!"); }
```
Compile both:
dmd main.d io.d
Compile separately:
dmd -c io.d
dmd main.d io.obj
Move the io.d module into a package, mylib.io:
- main.d
-- mylib
--- io.d
Add a module statement to the top of io.d:
```
module mylib.io;
```
Change the import in main.d:
```
import mylib.io;
```
Try again compiling together, then separately. Then move the
mylib directory:
- main.d
-- lib
--- mylib
---- io.d
Then compile together and separately again. Try with and without
-Ilib in both cases and see what happens. Add another
single-function module into the mix. Compile mylib as a library
and try again.
Just keep experimenting like this until you've worked out exactly
what's going on and what the error messages mean. Then you can
tackle the naonvg and arsd.