c++ - Symbols not found for architecture i386 - But works for iOS device -


i facing strange problem here, trying integrate libkml c++ project sources ios project. project compiles independently fine, when comes linking through line of code:

kmldom::pointptr apppoint = kmlconvenience::createpointlatlon(applocation.coordinate.latitude, applocation.coordinate.longitude); 

i linker errors only when building simulator. works fine when build ios device, simulator following 3 linker errors:

(null): "kmldom::gxtimespan::gxtimespan()", referenced from:  (null): kmldom::kmlfactory::creategxtimespan() const in liblibkml.a(kml_factory.o)  (null): "kmldom::gxtimestamp::gxtimestamp()", referenced from:  (null): kmldom::kmlfactory::creategxtimestamp() const in liblibkml.a(kml_factory.o)  (null): symbol(s) not found architecture i386  (null): linker command failed exit code 1 (use -v see invocation) 

these errors occur when try build simulator

i fine developing device alone looking fix problem 2 reasons:

  1. would easy team use simulator @ times development purposes.
  2. i want bottom of , understand why happening in first case. why builds device , fails simulator though target same , source files included in target same across simulator device?.

the definition of gxtimestamp , gxtimespan classes in header file gx_timeprimitive.h , contents:

#ifndef kml_dom_gx_timeprimitive_h__ #define kml_dom_gx_timeprimitive_h__  #include <string> #include "kml/base/xml_namespaces.h" #include "kml/dom/kml22.h" #include "kml/dom/object.h" #include "kml/dom/timeprimitive.h"  namespace kmldom {  class serializer; class visitor;  // <gx:timespan> class gxtimespan : public timespan {  public:   virtual ~gxtimespan();   static kmldomtype elementtype() {     return type_gxtimespan;   }   virtual kmldomtype type() const { return type_gxtimespan; }   virtual bool isa(kmldomtype type) const {     return type == type_gxtimespan || timespan::isa(type);   }    // visitor api methods, see visitor.h.   virtual void accept(visitor* visitor);   private:   friend class kmlfactory;   gxtimespan();   libkml_disallow_evil_constructors(gxtimespan); };  // <gx:timestamp> class gxtimestamp : public timestamp {  public:   virtual ~gxtimestamp();   static kmldomtype elementtype() {     return type_gxtimestamp;   }   virtual kmldomtype type() const { return type_gxtimestamp; }   virtual bool isa(kmldomtype type) const {     return type == type_gxtimestamp || timestamp::isa(type);   }    // visitor api methods, see visitor.h.   virtual void accept(visitor* visitor);   private:   friend class kmlfactory;   gxtimestamp();   libkml_disallow_evil_constructors(gxtimestamp); };  }  // end namespace kmldom  #endif  // kml_dom_gx_timeprimitive_h__ 

i have read many posts linker errors occur coz source files not compiled. thinking in same lines solve problem too, cannot include header file compile sources because .h file.

also, double checked - kml_factory.cc file included in compile sources of inner project:

kml_factory.cc file included in compile phase

looking forward suggestions , help. thanks.

makes me feel stupid this, but, don't know how gx_timeprimitive.cc file missing. in impression gx_timeprimitive.h file complete has virtual classes , tried define gxtimespan , gxtimestamp classes providing empty implementation of constructors in private scope, this:

class gxtimespan : public timespan {  public:   virtual ~gxtimespan();   static kmldomtype elementtype() {     return type_gxtimespan;   }   virtual kmldomtype type() const { return type_gxtimespan; }   virtual bool isa(kmldomtype type) const {     return type == type_gxtimespan || timespan::isa(type);   }    // visitor api methods, see visitor.h.   virtual void accept(visitor* visitor);   private:   friend class kmlfactory;   gxtimespan()   {    }   libkml_disallow_evil_constructors(gxtimespan); }; 

but still, compiler not create object file out of interface files (.h files excluded compile sources, contain declarations), hence linker cannot find constructors needed. made me search gx_timeprimitive.cc file in internet , indeed available.

thinking cool head have saved me 100 bounty points, have lesson carry!

also, answer why giving error in simulator mode alone: line mentioned above - kmldom::pointptr apppoint = kmlconvenience::createpointlatlon(applocation.coordinate.latitude, applocation.coordinate.longitude); when built armv7, think, unless variable apppoint used elsewhere in code linker skips linking sources of libkml's object file. whereas, i386 perform linking irrespective of whether variable used in code or not. guess sort of compiler optimisation due behaviour different in respective architectures. puzzle made me miss crucial clue of looking missing file!

apologies took time solve silly problem of mine, thank all.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -