Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
May 09, 2004 Error importing std.socket ? | ||||
---|---|---|---|---|
| ||||
Hi everybody, I've been trying to use sockets now that they are included in phobos, but I must have forgotten to do something somewhere. When I try to compile a file containing just "import std.socket;" in it, dmd spits out a bunch of errors I don't really understand : gcc sockets.o -o sockets -lphobos -lpthread -lm /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(dmain2.o)(.gnu.linkonce.tmain+0x64): In function `main': : undefined reference to `_Dmain' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(deh2.o)(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x4): In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable': : undefined reference to `_deh_beg' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(deh2.o)(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0xc): In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable': : undefined reference to `_deh_beg' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(deh2.o)(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x13): In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable': : undefined reference to `_deh_end' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(deh2.o)(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x37): In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable': : undefined reference to `_deh_end' collect2: ld returned 1 exit status --- errorlevel 256 /usr/lib/libphobos.a is the last libphobos.a from the 0.88 zip archive. Anyone knows where the problem could come from ? (I probably overlooked something evident somewhere :) Thanks. -- Schee |
May 09, 2004 Re: Error importing std.socket ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to SeeSchloss | You need a main method. You'll find that you get that error upon importing any module. Try adding:
int main(char[][] args) { return 0; }
to your file.
On Sun, 09 May 2004 19:07:24 +0200, SeeSchloss wrote:
> Hi everybody,
>
> I've been trying to use sockets now that they are included in phobos, but I must have forgotten to do something somewhere. When I try to compile a file containing just "import std.socket;" in it, dmd spits out a bunch of errors I don't really understand :
>
> gcc sockets.o -o sockets -lphobos -lpthread -lm
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(dmain2.o)(.gnu.linkonce.tmain+0x64):
> In function `main':
> : undefined reference to `_Dmain'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(deh2.o)(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x4):
> In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable':
> : undefined reference to `_deh_beg'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(deh2.o)(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0xc):
> In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable':
> : undefined reference to `_deh_beg'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(deh2.o)(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x13):
> In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable':
> : undefined reference to `_deh_end'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libphobos.a(deh2.o)(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x37):
> In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable':
> : undefined reference to `_deh_end'
> collect2: ld returned 1 exit status
> --- errorlevel 256
>
> /usr/lib/libphobos.a is the last libphobos.a from the 0.88 zip archive.
>
> Anyone knows where the problem could come from ? (I probably overlooked something evident somewhere :)
>
> Thanks.
Mike Swieton
__
The difference between losers and winners is that losers don't fail enough.
- Ross Jeffries
|
May 09, 2004 Re: Error importing std.socket ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Swieton | Mike Swieton wrote:
> You need a main method. You'll find that you get that error upon importing
> any module. Try adding:
>
> int main(char[][] args) { return 0; }
>
> to your file.
OMG, I'm so ashamed :-/
Actually I accidentaly launched a compilation before writing anything else, and after seeing the errors I didn't even try to go further...
Well, next time I'll ponder a bit before getting in panic :)
Thanks
--
Schee
|
May 09, 2004 Re: Error importing std.socket ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to SeeSchloss | On Sun, 09 May 2004 20:18:52 +0200, SeeSchloss <seeschloss@seeschloss.org> wrote: > Mike Swieton wrote: >> You need a main method. You'll find that you get that error upon importing >> any module. Try adding: >> >> int main(char[][] args) { return 0; } >> >> to your file. > > OMG, I'm so ashamed :-/ We all do something like this every now and again :) > Actually I accidentaly launched a compilation before writing anything else, and after seeing the errors I didn't even try to go further... If the compiler error was clearer... > Well, next time I'll ponder a bit before getting in panic :) > > Thanks > > -- > Schee -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
May 09, 2004 Re: Error importing std.socket ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | "Regan Heath" <regan@netwin.co.nz> wrote in message news:opr7q59gfy5a2sq9@digitalmars.com... > On Sun, 09 May 2004 20:18:52 +0200, SeeSchloss <seeschloss@seeschloss.org> wrote: > > Mike Swieton wrote: > >> You need a main method. You'll find that you get that error upon > >> importing > >> any module. Try adding: > >> > >> int main(char[][] args) { return 0; } > >> > >> to your file. > > > > OMG, I'm so ashamed :-/ > > We all do something like this every now and again :) > > > Actually I accidentaly launched a compilation before writing anything else, and after seeing the errors I didn't even try to go further... > > If the compiler error was clearer... You mean somthing like the following, which is written in the third line of the error? " In function `main': : undefined reference to `_Dmain' " Phill > > > Well, next time I'll ponder a bit before getting in panic :) > > > > Thanks > > > > -- > > Schee > > > > -- > Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
May 09, 2004 Re: Error importing std.socket ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phill | On Mon, 10 May 2004 09:32:10 +1000, Phill <phill@pacific.net.au> wrote: > "Regan Heath" <regan@netwin.co.nz> wrote in message > news:opr7q59gfy5a2sq9@digitalmars.com... >> On Sun, 09 May 2004 20:18:52 +0200, SeeSchloss <seeschloss@seeschloss.org> >> wrote: >> > Mike Swieton wrote: >> >> You need a main method. You'll find that you get that error upon >> >> importing >> >> any module. Try adding: >> >> >> >> int main(char[][] args) { return 0; } >> >> >> >> to your file. >> > >> > OMG, I'm so ashamed :-/ >> >> We all do something like this every now and again :) >> >> > Actually I accidentaly launched a compilation before writing anything >> > else, and after seeing the errors I didn't even try to go further... >> >> If the compiler error was clearer... > > You mean somthing like the following, which is written in the third line of > the error? > > " In function `main': > : undefined reference to `_Dmain' " Yes, without the others.. so it's clear. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
Copyright © 1999-2021 by the D Language Foundation