This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

no explicit instantiations of ifstream, ofstream?



hi -

I was just trying to build orbacus using libstdc++-v3, and i got complaints
about missing vtabs for ifstream and ofstream:

/usr/local/egcs/include/g++-v3/bits/std_fstream.h:266: undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::std::basic_ios<char, std::char_traits<char> > virtual table'
../../lib/libOB.so: undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::std::basic_ios<char, std::char_traits<char> > virtual table'


I see that misc-inst.cc has explicit instantiations for many of the
iostream classes, but not for these two.  Was there any real reason for
that omission?

I tried adding those instantiations with the patch below, and the
problem went away.

thanks,
sss


2000-04-27  scott snyder  <snyder@fnal.gov>

	* src/misc-inst.cc: Explicitly instantiate ifstream and ofstream
	classes.


Index: src/misc-inst.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/misc-inst.cc,v
retrieving revision 1.1
diff -u -p -r1.1 misc-inst.cc
--- misc-inst.cc	2000/04/21 20:33:33	1.1
+++ misc-inst.cc	2000/04/27 23:00:22
@@ -151,6 +151,24 @@ namespace std {
 
 
   //
+  // ifstream
+  //
+  template class basic_ifstream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+  template class basic_ifstream<wchar_t>; 
+#endif
+
+
+  //
+  // ofstream
+  //
+  template class basic_ofstream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+  template class basic_ofstream<wchar_t>; 
+#endif
+
+
+  //
   // istringstream
   //
   template class basic_istringstream<char>;

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