Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
gcc linking question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gcc linking question



Hi all,

Have searched around for clues to this, but to no avail. The following code used
to compile with older versions of gcc (eg, with Panther). It still compiles with
gcc 4.1.1 on my Fedora system, but appears broken on the current Xcode for 10.4:

--------------------------------------------------------------------------------

#include <iostream>

class Merp{
   public:
     void Print(){std::cout << Merp::Thing << std::endl;}
   private:
      const static double Thing = 1.00;
};

int main(){
   Merp asdf;
   asdf.Print();
}

--------------------------------------------------------------------------------

I get lip from the linker when I do this - it claims that Thing is an undefined
symbol. Is there a trick to assigning values to variables within the class
declaration with the gcc that ships with Xcode 2.4 etc?  Thanks for any help!


- Lowell

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

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.