Imports and Subfolders and Links (Oh, My!)
Ron Tarrant
rontarrant at gmail.com
Fri Dec 7 16:39:34 UTC 2018
Trying to wrap my brain around imports, etc.
In various places around the Internet, I've read that if I have
modules in a subfolder/subdirectory, my import statement would
look like this:
import subfolder.ModuleName;
And in the module files, the first statement is:
module ModuleName;
However, I'm having trouble getting past the compile errors.
Scenario:
current folder contains - main.d
In main.d, the import statements:
import app.CountryTreeView
import app.CountryListStore
In the subfolder (named: app) I have two module files:
- CountryTreeView.d (module CountryTreeView)
- CountryListStore.d (module CountryListStore)
When I compile using:
dmd -m64 -Lgtkd.lib main.d
I get a bunch of unresolved external symbol errors for classes
and modules. The import statements in main.d don't import
anything from the subfolder.
Removing 'app.' from the import statements and compiling with:
dmd -m64 -Lgktd.lib main.d -Iapp CountryListStore CountryTreeView
it works.
Two questions:
1) Under what circumstances would I prefix the folder/directory
name in a statement importing modules I've built myself?
2) What would the dmd compile command look like?
More information about the Digitalmars-d-learn
mailing list