Note that there are some explanatory texts on larger screens.

plurals
  1. POLink error with Objective-C++/C++ in XCode 4.2 Lion (iOS product)
    text
    copied!<p>I am new to Objective-C and a bit rusty at using C++ and templates, and I am not sure why I am having this link error.</p> <p>I have a header file that contains definitions similar to these:</p> <pre><code>struct Info { std::string name; }; typedef std::map&lt;std::string, Info&gt; InfoMap; void Validate(InfoMap* infoMap); @interface InfoValidator : NSObject { } +(InfoValidator*) getInstance; -(void) validate:(InfoMap*)infoMap; @end </code></pre> <p>I also have an .mm file that contains the following definition for the (global) Validate() method:</p> <pre><code>void Validate(InfoMap* infoMap) { [[InfoValidator getInstance] validate:infoMap]; } </code></pre> <p>When I call Validate() from a C++ class (defined in an .mm file), I receive the following error:</p> <pre><code>Undefined symbols for architecture armv7: Validate(std::map&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, Info, std::less&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, &gt; std::allocator&lt;std::pair&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, ?&gt; std::allocator&lt;char&gt; &gt; const, Info&gt; &gt; &gt;*)", referenced from: ItemInterface::ValidateItems(int, char const**)in iteminterface.o ld: symbol(s) not found for architecture armv7 collect2: ld returned 1 exit status </code></pre> <p>The file has been added to the project, and it is the only link error I get. Thanks for any help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload