🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools.mfc
Article #51

Re: Unresolved external "_printf" in Visual C++ 1.52

#51
From: Guus Leeuw jr.
Date: Sun, 11 Feb 1996 15:53
34 lines
1674 bytes
clin@xn-tech.com wrote:
[snip snip]
> I pasted some old, tested C codes to my C++ program. I got the following linker error
> 
> error L2029: '_printf' : unresolved external
> 
> In my program, I have include these libraries:
> 
> extern "C" {
> #include <dos.h>
> #include <conio.h>
> #include <ctype.h>
> #include <stdlib.h>
> #include <string.h>
> #include <stdio.h>
> #include <bios.h>
> }

Removing the `extern "C"' will do pretty much, I guess.

What's going on? The C++ compiler comes across extern "C" and starts a
different name mangling routine than without `extern "C"'. (In C all
names are mangled by a '_' prefix; this story is a little different in
C++.)

I suspect that the libraries coming with your compiler are compiled with
that compiler and thus all names in the library should be mangled in the
C++ styles. To check this you can, in some way, get information about
all the modules and names in any library.

But I'd first try removing `extern "C"', it's a lot easier ;-)

Hope this helps,
	Guus Leeuw jr.
Technical Details
Message-ID: <311E10F2.6C9A08E1@eiffel.com>
Path: arc1-ca.pugleaf.net!news.rain.org!usenet
References: <4fj37r$l54@express2.ior.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.rain.org!usenet
From: "Guus Leeuw jr." <guusl@eiffel.com>
Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.lang.c++
Subject: Re: Unresolved external "_printf" in Visual C++ 1.52
Date: Sun, 11 Feb 1996 10:53:22 -0500
Organization: Interactive Software Engineering Inc. hhtp://www.eiffel.com/
Message-ID: <311E10F2.6C9A08E1@eiffel.com>
References: <4fj37r$l54@express2.ior.com>
NNTP-Posting-Host: @outback.eiffel.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0 (X11; I; Linux 1.2.13 i586)
To: clin@xn-tech.com