[comp.lang.c] Help. Problems compiling GNU C++

mwette%newton@hub.ucsb.edu (Matt Wette) (02/22/88)

Please help.  I'm compiling GNU C++ (1.18.0) on a Sun 3/60 running SunOS 3.4
with SunPro installed.  The loader (ld) complains with 
	Undefined:
	_obstack_free
	*** Error code 1

For the sun (non-"_STDC_") compiler obstack_free gets more-or-less expanded
to "_obstack_free".  This function (actually macro) is called in lex.c and
tree.c.  When I "cc -E lex.c" I get

	.
	.
	_obstack_begin (...
	.
	.
	... : (int) _obstack_free (...
	.
	.

However "nm lex.o" gives me

	.
	.
	U __obstack_begin
	.
	.
	U _obstack_free

What gives?

macro definitions for "obstack_begin" and "obstack_free" are, respectively,

#define obstack_begin(h, size) \
  _obstack_begin ((h), (size), 4, obstack_chunk_alloc, obstack_chunk_free)

#define obstack_free(h,obj)                                             \
( (h)->temp = (char *)(obj) - (char *) (h)->chunk,                      \
  (((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
   ? (int) ((h)->next_free = (h)->object_base                           \
            = (h)->temp + (char *) (h)->chunk)                          \
   : (int) _obstack_free ((h), (h)->temp + (char *) (h)->chunk)))
#endif

Matt 
 _____________________________________________________________________________
 Matthew R. Wette			| ARPA: mwette%gauss@hub.ucsb.edu
 Scientific Computation Lab		| UUCP: ucbvax!ucsbhub!gauss!mwette
 Dept. Elec. and Comp. Eng.		|
 University of California		|
 Santa Barbara, CA  93106		|
 -----------------------------------------------------------------------------

phr@web5b.berkeley.edu (Paul Rubin) (02/23/88)

>[Person describes problem with undefined symbols resulting from use of obstack]

You forgot to link obstack.o into the program.  Perhaps that is a makefile
bug, although I think the makefile has a comment to the effect that you
must change it if you haven't installed obstack.o in /usr/lib on your system.
Send bugs of this sort to bug-g++@prep.ai.mit.edu.

	paul rubin