Xref: utzoo comp.binaries.ibm.pc.d:12959 comp.sys.ibm.pc.misc:7336 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!fuug!news.funet.fi!uta!kielo!av From: av@kielo.uta.fi (Arto V. Viitanen) Newsgroups: comp.binaries.ibm.pc.d,comp.sys.ibm.pc.misc Subject: Re: gcc new version, c++ printf() != _printf Message-ID: Date: 11 Mar 91 09:17:28 GMT References: <1991Mar11.042013.4674@IRO.UMontreal.CA> Sender: news@uta.fi Reply-To: av@uta.fi (Arto Viitanen) Organization: University of Tampere, Finland Lines: 32 Nntp-Posting-Host: uta.fi In-reply-to: vero@IRO.UMontreal.CA's message of 11 Mar 91 04:20:13 GMT >>>>> 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 #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