Thread overview
Trouble with -lib in linux "undefined reference to `_Dmain'"
Feb 29, 2012
André
Feb 29, 2012
Kevin Cox
Feb 29, 2012
André
February 29, 2012
Hi,
I use Mono-D and have a hello world example which compiles fine.
I set the compiler option "-lib" and receives an error "undefined reference to `_Dmain'".

Following commands are generated for the build process:
dmd -c "main.d" -of"/home/user/Dokumente/MonoDevelop/HelloWorld/HelloWorld/obj/Debug/main.o" -I"/usr/include/d/dmd/phobos" -I"/usr/include/d/dmd/druntime/import" -gc -debug -lib

dmd -gc -debug -of"/home/user/Dokumente/MonoDevelop/HelloWorld/HelloWorld/bin/Debug/HelloWorld" "obj/Debug/main.o"

Do I miss an additional linux option or is the order of the commands wrong?

Kind regards
André
February 29, 2012
I think you need the -lib in the linker command (too?).
On Feb 29, 2012 12:25 PM, "André" <andre@s-e-a-p.de> wrote:

> Hi,
> I use Mono-D and have a hello world example which compiles fine.
> I set the compiler option "-lib" and receives an error "undefined
> reference to `_Dmain'".
>
> Following commands are generated for the build process:
> dmd -c "main.d" -of"/home/user/Dokumente/**MonoDevelop/HelloWorld/**HelloWorld/obj/Debug/main.o"
> -I"/usr/include/d/dmd/phobos" -I"/usr/include/d/dmd/**druntime/import"
> -gc -debug -lib
>
> dmd -gc -debug -of"/home/user/Dokumente/**MonoDevelop/HelloWorld/** HelloWorld/bin/Debug/**HelloWorld" "obj/Debug/main.o"
>
> Do I miss an additional linux option or is the order of the commands wrong?
>
> Kind regards
> André
>


February 29, 2012
you are right, that was the error.
Thanks.

Kind regards
André

Am 29.02.2012 18:27, schrieb Kevin Cox:
> I think you need the -lib in the linker command (too?).
>
> On Feb 29, 2012 12:25 PM, "André" <andre@s-e-a-p.de
> <mailto:andre@s-e-a-p.de>> wrote:
>
>     Hi,
>     I use Mono-D and have a hello world example which compiles fine.
>     I set the compiler option "-lib" and receives an error "undefined
>     reference to `_Dmain'".
>
>     Following commands are generated for the build process:
>     dmd -c "main.d"
>     -of"/home/user/Dokumente/__MonoDevelop/HelloWorld/__HelloWorld/obj/Debug/main.o"
>     -I"/usr/include/d/dmd/phobos"
>     -I"/usr/include/d/dmd/__druntime/import" -gc -debug -lib
>
>     dmd -gc -debug
>     -of"/home/user/Dokumente/__MonoDevelop/HelloWorld/__HelloWorld/bin/Debug/__HelloWorld"
>     "obj/Debug/main.o"
>
>     Do I miss an additional linux option or is the order of the commands
>     wrong?
>
>     Kind regards
>     André
>