• 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: Strange linking problem with Objective-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange linking problem with Objective-C++


  • Subject: Re: Strange linking problem with Objective-C++
  • From: Wade Williams <email@hidden>
  • Date: Sun, 16 Aug 2009 23:15:22 -0500


On Aug 15, 2009, at 7:00 PM, Ken Thomases wrote:

On Aug 15, 2009, at 12:28 PM, Wade Williams wrote:

All indications at this point would be that the routine isn't defined.  However, it's there when I examine the static library into which it's compiled:

xanadu:Debug wwilliam$ nm -A libwindow.a | grep getLoopingVar
libwindow.a:wlwindowmac.o: 00000090 T __ZN6window11wlWindowMac13getLoopingVarEv
libwindow.a:wlwindowmac.o: 00000000 A __ZN6window11wlWindowMac13getLoopingVarEv.eh
libwindow.a:test.o:          U __ZN11wlWindowMac13getLoopingVarEv

No, it's not there.  In test.o, __ZN11wlWindowMac13getLoopingVarEv (wlWindowMac::getLoopingVar()) is undefined (U).  In wlwindowmac.o, __ZN6window11wlWindowMac13getLoopingVarEv (window::wlWindowMac::getLoopingVar()) is defined.  As you can see just by looking at them, these symbols do not match.  In particular, they differ by the presence of the "window" namespace qualifier.

It seems that in some compilation units, wlWindowMac is declared to be within the window namespace, but in other compilation units it is not.  The source clipping you provided is not sufficient to see why that's so.  I recommend that you preprocess test.cpp and wlWindowMac.app and compare them for inconsistent namespace scoping of the declarations of wlWindowMac in each case.


Ken, thanks so much.  I was totally looking past the extra "window" in the nm output and was thinking that because I saw a "T" it was defined and I just wasn't understanding the output (which of course was still true).

You were right on target - the class was within the namespace in some compilation units, but not others.  Problem fixed.

Wade
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Strange linking problem with Objective-C++ (From: Wade Williams <email@hidden>)
 >Re: Strange linking problem with Objective-C++ (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: how do you go back
  • Next by Date: Re: how do you go back
  • Previous by thread: Re: Strange linking problem with Objective-C++
  • Next by thread: how do you go back
  • Index(es):
    • Date
    • Thread