Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 16, 2010 [Issue 3975] New: Misnamed main causes linker errors | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3975 Summary: Misnamed main causes linker errors Product: D Version: 1.057 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: baseball.mjp@gmail.com --- Comment #0 from Michael P <baseball.mjp@gmail.com> 2010-03-16 08:15:49 PDT --- typo.d: void mann() { } michael@michael-laptop:~/d/projects$ dmd typo.d /home/michael/dmd/linux/bin/../lib/libphobos.a(dmain2_7a_1a5.o): In function `main': internal/dmain2.d:(.text.main+0x74): undefined reference to `_Dmain' internal/dmain2.d:(.text.main+0xc5): undefined reference to `_Dmain' /home/michael/dmd/linux/bin/../lib/libphobos.a(deh2_171_525.o): In function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable': internal/deh2.d:(.text._D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x4): undefined reference to `_deh_beg' internal/deh2.d:(.text._D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0xc): undefined reference to `_deh_beg' internal/deh2.d:(.text._D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x13): undefined reference to `_deh_end' internal/deh2.d:(.text._D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x37): undefined reference to `_deh_end' collect2: ld returned 1 exit status --- errorlevel 1 Should this be happening? Compiling with -c is fine, and produces no output. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 07, 2011 [Issue 3975] Misnamed main causes linker errors | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michael P | http://d.puremagic.com/issues/show_bug.cgi?id=3975 Bernard Helyer <blood.of.life@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |blood.of.life@gmail.com Resolution| |INVALID --- Comment #1 from Bernard Helyer <blood.of.life@gmail.com> 2011-02-07 02:33:12 PST --- Yes, that is working as intended. When you compile without '-c' you are telling DMD to build you an executable -- one whose entry point is 'main'; so the linker looks for the function, and can't find it, and tells you so. This behaviour is the same as in C or C++. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 07, 2011 [Issue 3975] Misnamed main causes linker errors | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michael P | http://d.puremagic.com/issues/show_bug.cgi?id=3975 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #2 from bearophile_hugs@eml.cc 2011-02-07 03:49:26 PST --- Yet, I'd like the front-end to catch (and show an error message) this common bug before it reaches the linker, if possible. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 12, 2011 [Issue 3975] Misnamed main causes linker errors | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michael P | http://d.puremagic.com/issues/show_bug.cgi?id=3975 --- Comment #3 from Bernard Helyer <blood.of.life@gmail.com> 2011-02-11 19:53:50 PST --- Agreed, but it's not quite as simple as checking the existence of a 'main' function when compiling without -c. If object files, libraries, or anything of the sort are being used -- all those must be searched for a main function. On Linux, where linking is handled by GCC, this would lead to duplication of code and work -- all for a fairly minor issue. Another option is to merely issue a warning if we don't see one -- this would lead to spurious warnings, and as DMD has no granularity options when it comes to warnings, is not really an option. So I think the only viable option is to handle the simple case, where the only thing passed to DMD is source files (as we know Phobos doesn't have a main). Not ideal, but should catch cases where the user is genuinely confused by the linker output. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation