Importing problems
Korey Peters
koreypeters at gmail.com
Wed Feb 13 09:57:52 PST 2013
Thanks for your response, H.S.Teoh.
On Wednesday, 13 February 2013 at 17:47:09 UTC, H. S. Teoh wrote:
> You need to specify both files on the command line, so that the
> linker
> knows where to find everything:
>
> rdmd sample.d sample_a.d
>
Running this from the command line produces (exactly?) the same
error...
me at ubuntu:~/src$ rdmd sample.d sample_a.d
/tmp/.rdmd-1000/rdmd-sample.d-94E53075E2E84D963426A11F2B81FDED/objs/sample.o:
In function `_Dmain':
sample.d:(.text._Dmain+0xa): undefined reference to
`_D8sample_a1A7__ClassZ'
collect2: error: ld returned 1 exit status
--- errorlevel 1
I tried swapping the order of the file names, but that didn't
help.
> But before you can actually use the stuff in the other file,
> that other
> file needs to be compiled as well (the 'import' only imports
> declarations; it doesn't actually compile the declared code),
> and it
> needs to be included in the linking stage so that all
> references between
> the source files can be linked properly.
Ah. I thought that the purpose of "rdmd" (as opposed to "dmd")
was to link the files automatically. Thanks.
More information about the Digitalmars-d-learn
mailing list