[C++-sig] boost 1.28 on OS X

ich at peabody.jhu.edu ich at peabody.jhu.edu
Thu Jun 13 04:31:50 CEST 2002


I'm having difficulty porting boost 1.28 to OS X using Apple's version of 
gcc 3.1, which does not seems to initialize templated static data members.

I've sent email to darwin-GCC3 at opensource.apple.com yesterday but haven't 
heard back yet (email included below).

For example, with the abstract test, I get:

c++   -g -fPIC -bundle -bundle_loader /usr/local/bin/python -framework 
Python -framework System -flat_namespace -undefined warning -lstdc++  -o 
"../../../libs/python/build/bin/abstract.so/gcc/debug/runtime-link-dynamic/shared-linkable-true/abstract.so"  
-L/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2/config 
-L../../../libs/python/build/bin/libboost_python.so/gcc/debug/runtime-link-dynamic/shared-linkable-true   
"../../../libs/python/build/bin/abstract.so/gcc/debug/runtime-link-dynamic/shared-linkable-true/abstract.o"    
-lutil -lboost_python  
    
ld: warning undefined symbols:
__ZN5boost6python6detail14class_registryI8AbstractE19static_class_objectE
__ZN5boost6python6detail14class_registryI8AbstractE22static_base_class_infoE
__ZN5boost6python6detail14class_registryI8AbstractE25static_derived_class_infoE

If I use Apple's gcc 2.95, I get a different error:
ld: warning undefined symbols:
___tiQ45boost6python6detailt15instance_holder1Z8Abstract

BTW, one test (getting_started1) does work!

Any help will be appreciated.

Thank you,

Ichiro Fujinaga
Computer Music Department
Peabody Institute of the Johns Hopkins University

===========================================
Date: Tue, 11 Jun 2002 18:34:56 -0400 (EDT)
From: ich at peabody.jhu.edu
To: darwin-GCC3 at opensource.apple.com
Subject: C++

The following code works on linux gcc 3.1 & 2.96 and OS X gcc 2.95
but OS X gcc 3.1 results in (c++ test.cpp):

ld: Undefined symbols:
__ZN3FooIiE1jE

=========================
#include <iostream>
using namespace std;

template <class T>
class Foo
{
 static int j;
public:
 T i;
 void reset() { i = j; }
};

template <class T>
  int Foo<T>::j = 0;

int main()
{
  Foo<int> f;
  f.i = 3;
  cout << f.i << endl;
  f.reset();
  cout << f.i << endl;
}








More information about the Cplusplus-sig mailing list