Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run.dlang.io: multiple modules sometimes cause linking errors #755

Open
pbackus opened this issue Aug 28, 2020 · 0 comments
Open

run.dlang.io: multiple modules sometimes cause linking errors #755

pbackus opened this issue Aug 28, 2020 · 0 comments

Comments

@pbackus
Copy link

pbackus commented Aug 28, 2020

This example compiles and runs:

--- bar.d
module bar;

--- main.d
module main;
void main() {}

This one doesn't:

--- bar.d
module bar;

--- foo.d
module foo;

--- main.d
module main;
void main() {}

...with the following error:

/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o:function _start: error: undefined reference to 'main'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

In both cases, the compiler is set to dmd and no compiler arguments are given.

Passing -run main.d as compiler arguments allows the second example to compile and run successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant