From owner-freebsd-hackers Mon Mar 4 11:19:36 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id LAA20873 for hackers-outgoing; Mon, 4 Mar 1996 11:19:36 -0800 (PST) Received: from fslg8.fsl.noaa.gov (fslg8.fsl.noaa.gov [137.75.131.171]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id LAA20868 for ; Mon, 4 Mar 1996 11:19:33 -0800 (PST) Received: by fslg8.fsl.noaa.gov (5.57/Ultrix3.0-C) id AA14026; Mon, 4 Mar 96 13:19:30 -0600 Received: by emu.fsl.noaa.gov (1.38.193.4/SMI-4.1 (1.38.193.4)) id AA00471; Mon, 4 Mar 1996 12:19:29 -0700 Date: Mon, 4 Mar 1996 12:19:29 -0700 Message-Id: <9603041919.AA00471@emu.fsl.noaa.gov> From: Sean Kelly To: erich@lodgenet.com Cc: hackers@freebsd.org In-Reply-To: <199603041812.MAA09741@jake.lodgenet.com> (erich@lodgenet.com) Subject: Re: C++ and wierd symbols Sender: owner-hackers@freebsd.org Precedence: bulk >>>>> "Eric" == "Eric L Hernes" writes: Eric> I'm trying to compile some c++ stuff and I'm getting wierd Eric> link errors, like c++ is trying to overload some functions. Eric> does anyone have a clue as what's wrong? Yep. You need extern "C" { void pnm_readpnm(whatever, whatever, ...); // Other functions declarations. } somewhere in editor.c. When you use C++, the symbols that are generated include type information. This process is called name mangling. Since pnm_readpnm() comes from a C, NOT a C++ file, then the type information isn't included, which is why you get undefined symbols. The extern "C" declaration above tells the C++ compiler to not mangle the names of the given functions. -- Sean Kelly NOAA Forecast Systems Laboratory kelly@fsl.noaa.gov Boulder Colorado USA http://www-sdd.fsl.noaa.gov/~kelly/