Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!wuarchive!sdd.hp.com!ucsd!pacbell.com!mips!sgi!shinobu!odin!sgihub!dragon!bananapc.wpd.sgi.com!ciemo From: ciemo@bananapc.wpd.sgi.com (Dave Ciemiewicz) Newsgroups: comp.sys.sgi Subject: Re: getopt and C++ Keywords: Problem Message-ID: <1991Mar4.190323.7378@dragon.wpd.sgi.com> Date: 4 Mar 91 19:03:23 GMT References: <1991Mar04.161843.27932@cs.ruu.nl> Sender: news@dragon.wpd.sgi.com (CNews Account) Reply-To: ciemo@bananapc.wpd.sgi.com (Dave Ciemiewicz) Organization: Silicon Graphics, CASE Group Lines: 27 In article <1991Mar04.161843.27932@cs.ruu.nl>, markov@cs.ruu.nl (Mark Overmars) writes: |> I have a simple question: How do I use the routine getopt with C++. What I did |> was to put |> |> extern int getopt(int,char **,char *); |> |> in the program. Now the loader complaints that getopt__FiPPcPc is undefined. |> |> How do I solve this? |> |> Mark Overmars If you are using C++ 2.0, you should change the extern definition to: extern "C" int getopt(int, char**, char*); The "C" denotes that external routine is a conventional C routine and directs the compiler to use the non-type-safe (unmangled) name for all references. -- =============================================================================== __ * __ _ __ ___ / \ / / / / \/ \/ \ "The sky is falling!" / / \/ / /\ / / said Chicken Little \___/\__/\_/ /_/ / \__/ * ===============================================================================