[comp.sys.ibm.pc.misc] gcc new version, c++ printf

vero@IRO.UMontreal.CA (Marc Verreault) (03/11/91)

  The new gnu c++/386 zipped at grape.ecs.clarkson.edu gave me some
problems when compiling the well known hello world program, c++
version (hello.cc). The problem seems to be related with the linker.
The program compile well but do not link and terminate with a non
existant printf(const char *, ...) error. I'checked .o file and it
contains a _printf__?? symbol instead of _printf. Since there is no
such symbol in libc.a, i want to know how to inform gcc that this
printf function is related to standard c lib?

  Is somebody have already write ATI 512k Rev 2 driver? If not, i am
working on it and i will send to DJ as soon as possible for future
releases.

Marc.

    ||   Marc Verreault, co-administrateur, Vision/CAO/FAO labs,
    \/                   Informatique et recherche operationnelle
  /\/\/\                 Universite de Montreal, Canada
         vero@iro.umontreal.ca
         fax: (514) 343-5834

av@kielo.uta.fi (Arto V. Viitanen) (03/11/91)

>>>>> On 11 Mar 91 04:20:13 GMT, vero@IRO.UMontreal.CA (Marc Verreault) said:


Marc>   The new gnu c++/386 zipped at grape.ecs.clarkson.edu gave me some
Marc> problems when compiling the well known hello world program, c++
Marc> version (hello.cc). The problem seems to be related with the linker.
Marc> The program compile well but do not link and terminate with a non
Marc> existant printf(const char *, ...) error. I'checked .o file and it
Marc> contains a _printf__?? symbol instead of _printf. Since there is no
Marc> such symbol in libc.a, i want to know how to inform gcc that this
Marc> printf function is related to standard c lib?

I think it is same problem I had: gcc defines macro _cplusplus to show that
program is a C++ program, but stdio.h (and all the other headers) check for
macro __cplusplus !! This macro is used in following way:

#ifdef __cplusplus
extern "C" {
#endif
<lots of C-type function definitions>
#ifdef __cplusplus
}
#endif

Without those extern "C" brackets, C++ generates names, which tell
argumenttypes of functions. Since C does not generates these names, extern
"C" tells C++ not to generate this kind of names.

--
Arto V. Viitanen				         email: av@kielo.uta.fi
University Of Tampere,				   	    av@ohdake.cs.uta.fi
Finland