[comp.sys.next] Using c++

kirchner@umn-cs.cs.umn.edu (Roger B. Kirchner) (04/24/91)

I've just tried using cc++ and am finding that it
chokes on stdio.h:
/usr/include/stdio.h:75: parse error before `new'

What to do?
Thanks.
Roger

lane@CAMIS.STANFORD.EDU (Christopher D. Lane) (04/24/91)

>In article <h+9Gak1x1@cs.psu.edu> melling@cs.psu.edu (Michael D Mellinger)
writes:
>In article <1991Apr24.012912.20557@cs.umn.edu> kirchner@umn-cs.cs.umn.edu
(Roger B. Kirchner) writes:
>>
>>   I've just tried using cc++ and am finding that it
>>   chokes on stdio.h:
>>   /usr/include/stdio.h:75: parse error before `new'
>>
>Copy stdio.h to a directory of your own.  Put an underscore in front
>of new to give you _new.  Then add the -Idirectory option to CFLAGS
>(in the makefile) to include the directory where you put stdio.h.
>
>BTW, the problem is new is a reserved word in C++.

Another, more generally accepted, and tested solution is to enclose
the #include/#import in a C++ style 'extern' statement:

	extern "C"
	{
	#import <stdio.h>
	}

other useful 'extern' environment is "Objective-C".

- Christopher