getopt and C++
Dave Ciemiewicz
ciemo at bananapc.wpd.sgi.com
Tue Mar 5 05:03:23 AEST 1991
In article <1991Mar04.161843.27932 at cs.ruu.nl>, markov at 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
\___/\__/\_/ /_/ / \__/
*
===============================================================================
More information about the Comp.sys.sgi
mailing list