Date: Mon, 4 Mar 1996 12:19:29 -0700 From: Sean Kelly <kelly@fsl.noaa.gov> To: erich@lodgenet.com Cc: hackers@freebsd.org Subject: Re: C++ and wierd symbols Message-ID: <9603041919.AA00471@emu.fsl.noaa.gov> In-Reply-To: <199603041812.MAA09741@jake.lodgenet.com> (erich@lodgenet.com)
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Eric" == "Eric L Hernes" <erich@lodgenet.com> 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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9603041919.AA00471>