Subject: Re: problems compiling c++ source
To: None <netbsd-help@netbsd.org>
From: Ethan Bakshy <ethan@enteract.com>
List: netbsd-help
Date: 09/05/1999 11:47:58
Alright, I have taken a bunch of suggestions from people about my
problem compiling c++ programs that use the apvector class. after
replacing the class files with the latest versions right from the
collegeboard site, I trying compiling a small source file that just
includes the apvector header. here's the source to it:

 /~~~ main.cpp

#include "apvector.h" int main (int argc, char **argv) {
    return (0); }

 \___ main.cpp

(taken from an email by richard rauch)

now it _should_ compile cleanly, there are clearly no syntax errors
in this source file, and a few other people on the list were able
to compile it fine. But for some reason, I am getting errors in
/usr/include/machine/types.h after I tried compiling the source
file with both ''gcc main.cpp'', ''g++ main.cpp''. My original
source file actually uses the object, as well as a few other
libraries, here it is:

 /~~~ main2.cpp

#include <iostream.h> #include <iomanip.h> #include <stdlib.h>
#include <time.h> #include "apvector.h"

int main ()
  {
	int i, k = 0; const int VECT_SIZE = 100; apvector<int>
	myVector(VECT_SIZE);

	srand(time(0));

    for( i = 0; i < VECT_SIZE; i++)
     myVector[i] = ( k += rand() % 10 );

	cout << myVector.binarySearch(myVector[75]);

	return 0; }

\___ main2.cpp

When I try compiling this one, it tells me that there are errors
in /usr/include/assert.h. My guess is either all my header files
are wacked, or maybe there is something wrong with my compiler?

One more thing- somebody told me that just compiling the apvector.cpp
file works fine for him (using c++ -Wall -c apvector.cpp), I get
syntax errors in my assert.h file, and then a whole bunch of errors
dealing with the apvector.cpp file.

Thanks,

--
ethan