This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: help for template woes with g++


> Those of you who are struggling with linker errors caused by templates (such
> as those found in STL) might like to know that -frepo works much better when
> combined with -O3.  It turns out that repo stumbles on inlined methods declared
> outside the class.  The -O3 forces the compiler to generate inline code,
> otherwise the compiler _decides_ what to inline and to generate.  See g++ info
> page for more details.
> 

Yes, this is a well-known problem. I believe I did document a few of these
cases a few years in my STL Newbie Guide (now hopelessly outdated). -frepo
has had problems as well, most of which have been fixed in egcs.

fwiw, with egcs-1.0 (and fsf 2.8 when released), this problem goes away,
at least on ELF and PE-COFF (i386). You can just let the compiler
instantiate all the templates it needs, and the linker will throw away the
duplicates.  Basically, the template instances go in named sections with
".linkonce"  attribute, and then linker does the rest. 

Sometime this weekend, I should have egcs-1.0 distribution for gnu-win32.

Regards,
Mumit -- khan@xraylith.wisc.edu
http://www.xraylith.wisc.edu/~khan/

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]