From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,a4a4244d855fba97 X-Google-Attributes: gid111c93,public From: "Martin Sinot" Subject: Re: Cxx Compile error Date: 2000/04/27 Message-ID: #1/1 X-Deja-AN: 616356692 References: <3908283E.B2CB22A4@hccnet.nl> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@chello.nl X-Trace: nlnews00.chello.com 956845200 212.187.69.101 (Thu, 27 Apr 2000 13:20:00 GMT) Organization: SPaSE BV X-MSMail-Priority: Normal NNTP-Posting-Date: Thu, 27 Apr 2000 13:20:00 GMT Newsgroups: comp.os.linux.alpha bubble wrote in message news:3908283E.B2CB22A4@hccnet.nl... > Hi there, > > I was trying to compile blackbox using cxx from compaq. > All was going well until the compiler hit Icon.cc where it gave the > following error: > > cxx: Error: Icon.cc, line 137: identifier "strcmp" is undefined > if (strcmp(name, "Unnamed")) { > ____________^ > > could comeone xplain why the identifier is undefined, > and strcmp is a function or am I really mistaken. > Keep in mind I am a novice at C. > > Thanks for your trouble > > Jigal #include In C, it is allowed to use a function without declaring it before. The compiler will issue a warning and treat it as a function with unknown parameters and returning int. Very dangerous on Alphas, if the function happens to return a pointer. In C++ this is forbidden. Functions must always be declared before use. g++ allows the use of undefined functions on the same basis as C, but this is not correct (g++ allows too much). Most other C++ compilers correctly reject undeclared functions. Unfortunately, some programmers are sloppy, use undeclared functions and turn off compiler warnings rather than fixing them. Reason why a program can be accepted by g++ and not by another compiler (like Compaq cxx). -- Martin Sinot Nijmegen, Netherlands martin@spase.nl