www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - undefined reference to

reply mitgedanken <mit gedanken.o> writes:
I use ``dmd package.d -verrors=3 -debug -I"../.."``.

I get
```sh
Error: undefined reference to 
`std.container.array.Array!(minimal.token.token.Token).Array.empty() const`
        referenced from `const bool 
std.container.array.Array!(minimal.token.token.Token).Array.opEquals(ref
const(std.container.array.Array!(minimal.token.token.Token).Array))`
```
Jun 13
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On Saturday, 14 June 2025 at 00:25:13 UTC, mitgedanken wrote:
 I use ``dmd package.d -verrors=3 -debug -I"../.."``.

 I get
 ```sh
 Error: undefined reference to 
 `std.container.array.Array!(minimal.token.token.Token).Array.empty() const`
        referenced from `const bool 
 std.container.array.Array!(minimal.token.token.Token).Array.opEquals(ref
const(std.container.array.Array!(minimal.token.token.Token).Array))`
 ```
You need to include all modules on the command line that you import, or use the -i switch. -Steve
Jun 14
parent reply mitgedanken <mit gedanken.o> writes:
On Saturday, 14 June 2025 at 13:46:20 UTC, Steven Schveighoffer 
wrote:
 On Saturday, 14 June 2025 at 00:25:13 UTC, mitgedanken wrote:
 [...]

 You need to include all modules on the command line that you 
 import, or use the -i switch.

 -Steve
Oh, yes! I completely forgot about that. Why isn't that the default behavior?!
Jun 14
parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 15/06/2025 3:25 AM, mitgedanken wrote:
 On Saturday, 14 June 2025 at 13:46:20 UTC, Steven Schveighoffer wrote:
 On Saturday, 14 June 2025 at 00:25:13 UTC, mitgedanken wrote:
 [...]

 You need to include all modules on the command line that you import, 
 or use the -i switch.

 -Steve
Oh, yes! I completely forgot about that. Why isn't that the default behavior?!
You may be linking against it separately. The -i behavior only works for small executables, when the build commands (yes plural) get more complex its not going to give you the control that you need.
Jun 14
parent reply mitgedanken <mit gedanken.o> writes:
On Saturday, 14 June 2025 at 15:28:27 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
 On 15/06/2025 3:25 AM, mitgedanken wrote:
 [...]
You may be linking against it separately. The -i behavior only works for small executables, when the build commands (yes plural) get more complex its not going to give you the control that you need.
I thought that's what the flag ``-I“...”`` was for. Provided the naming conforms to the standard.
Jun 14
parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 15/06/2025 5:42 AM, mitgedanken wrote:
 On Saturday, 14 June 2025 at 15:28:27 UTC, Richard (Rikki) Andrew 
 Cattermole wrote:
 On 15/06/2025 3:25 AM, mitgedanken wrote:
 [...]
You may be linking against it separately. The -i behavior only works for small executables, when the build commands (yes plural) get more complex its not going to give you the control that you need.
I thought that's what the flag ``-I“...”`` was for. Provided the naming conforms to the standard.
-i uses the import path switches to source files from. By default the D compiler defaults to looking in current working directory, hence why -i by itself works.
Jun 14