• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: templates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: templates


  • Subject: Re: templates
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Thu, 2 Oct 2003 10:24:42 +0100

On Thursday, October 2, 2003, at 08:52 am, Francisco Tolmasky wrote:

Ok, I'm using objective-C++ so part of my program uses C++ templates. I have a class structure something like this:

[snip]

The problem is my specialization (primitive<int>). For some reason it makes an error of "multipel definitions of symbol primitive<int>::read(char const *). I tried it in Codewarrior and it did the same thing. I really can't figure it out. I know it's something that I'm doing wrong with templates and specifically template specialization but I don't know what! I include primitive.hpp in several places but I have the inclusion guards. I read somewhere about multiple instances of templates being global or something?

ANY help is GREATLY appreciated,

This is really a C++ question, so you would be better off asking in comp.lang.c++. It sounds to me like the problem is that you have multiple instantations of your template for some reason, and because of the linker behaviour on Mac OS X, multiple definitions of the same symbol are not allowed. The GCC manual has a section that explains the available options in its case; see

http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/gcc/ Template-Instantiation.html#Template Instantiation

The -frepo or -fno-implicit-template-instantiation flags are probably what you want, depending on the instantiation model you prefer.

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >templates (From: Francisco Tolmasky <email@hidden>)

  • Prev by Date: Re: problem with menuitem's keyEquivalent
  • Next by Date: Bug Deployement App / Zero-Link
  • Previous by thread: templates
  • Next by thread: Programatically setting LSUIElement
  • Index(es):
    • Date
    • Thread