How to return range constructs?

anonymous anonymous at example.com
Fri Feb 28 16:40:24 PST 2014


On Friday, 28 February 2014 at 23:53:48 UTC, Robin wrote:
> I have made matrix a struct for a better performance and since 
> everybody here on the forums was complaining about that it 
> should be a struct type.

Making it a class is just a simple way to avoid the (explicit) 
pointer. Weigh that against your other goals and decide. Also, a 
pointer in itself isn't scarily unsafe.

> When I uncomment the currently commented assertion I get 
> linking errors. (these strange and nearly unreadable error 
> messages.)
>
> Here is a part of them:
[...]
> undefined reference to 
> `_D6neoLab4core9Dimension9Dimension6__ctorMFNaNbNcxmxmZS6neoLab4core9Dimension9Dimension'

"undefined reference" means the linker can't find that symbol. 
That means, you forgot to pass some file in. When compiling and 
linking in one step, dmd needs all source files: something like 
`dmd neoLab/core/ColumnVectorForwardRange.d neoLab/core/Matrix.d
neoLab/core/Dimension.d` (plus any other imported files outside
of phobos).

rdmd is a tool that reads the imports, calls dmd on all source 
files, and then runs the executable. It's shipped with dmd. With 
rdmd it would be just `rdmd 
neoLab/core/ColumnVectorForwardRange.d`.


More information about the Digitalmars-d-learn mailing list