This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++ problem after compiling gcc-4.0 with the -fvisibity-inlines


I just compiled gcc-4.0 with the fvisibility-inlines-hidden option,
and I get undefined symbols when linking c++ code with libstdc++.
For example this simple c++ file does not compile:

  #include <string>
  #include <iostream>
  using namespace std;
  int main (void)
  {
    basic_string <char>a = "thing one";
    string b = "thing two";
    cout << a.c_str() << endl;
    return (a == b);
  }

I get the following errors:

tmp/ccK2jGQY.o(.text+0x24): In function `main':
test.cpp: undefined reference to `std::allocator<char>::allocator()'
/tmp/ccK2jGQY.o(.text+0x51):test.cpp: undefined reference to
`std::allocator<char>::~allocator()'
/tmp/ccK2jGQY.o(.text+0x6a):test.cpp: undefined reference to
`std::allocator<char>::~allocator()'
/tmp/ccK2jGQY.o(.text+0x75):test.cpp: undefined reference to
`std::allocator<char>::allocator()'
/tmp/ccK2jGQY.o(.text+0xa2):test.cpp: undefined reference to
`std::allocator<char>::~allocator()'
/tmp/ccK2jGQY.o(.text+0xb2):test.cpp: undefined reference to
`std::allocator<char>::~allocator()'
/tmp/ccK2jGQY.o(.text+0xbd):test.cpp: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::c_str() const'
/tmp/ccK2jGQY.o(.text+0xdd):test.cpp: undefined reference to
`std::basic_ostream<char, std::char_traits<char>
>::operator<<(std::basic_ostream<char, std::char_traits<char> >&
(*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccK2jGQY.o(.text+0x100):test.cpp: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~basic_string()'
/tmp/ccK2jGQY.o(.text+0x113):test.cpp: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~basic_string()'
/tmp/ccK2jGQY.o(.text+0x129):test.cpp: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~basic_string()'
/tmp/ccK2jGQY.o(.text+0x142):test.cpp: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~basic_string()'
/tmp/ccK2jGQY.o(.gnu.linkonce.t._ZSteqIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_ES8_[bool
std::operator==<char, std::char_traits<char>, std::allocator<char>
>(std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)]+0x14): In function `bool
std::operator==<char, std::char_traits<char>, std::allocator<char>
>(std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)':
test.cpp: undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char>
>::compare(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&) const'
collect2: ld returned 1 exit status

So it is not safe to compile gcc with the fvisibility-inlines-hidden
option?

Regards
	Papadakos Panagiotis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]