* Cxx Compile error
@ 2000-04-27 4:00 bubble
2000-04-27 4:00 ` bubble
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: bubble @ 2000-04-27 4:00 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Cxx Compile error
2000-04-27 4:00 Cxx Compile error bubble
@ 2000-04-27 4:00 ` bubble
2000-04-27 4:00 ` Alex Rhomberg
2000-04-27 4:00 ` Aaron Sawyer
2000-04-27 4:00 ` Martin Sinot
2000-04-27 4:00 ` bubble
2 siblings, 2 replies; 9+ messages in thread
From: bubble @ 2000-04-27 4:00 UTC (permalink / raw)
bubble wrote:
>
> 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
Some additional info,
taken from compaq c++ portining note's:
"compiler strictly enforces the requirement to define functions before
they are used. This requirement also applies to built-in functions such
as 'strlen' .
So am i to conclude that something needs to be defined for strcmp
aswell?
If so what would that be?
Thanks again
Jigal
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Cxx Compile error
2000-04-27 4:00 Cxx Compile error bubble
2000-04-27 4:00 ` bubble
@ 2000-04-27 4:00 ` Martin Sinot
2000-04-27 4:00 ` bubble
2000-04-27 4:00 ` bubble
2 siblings, 1 reply; 9+ messages in thread
From: Martin Sinot @ 2000-04-27 4:00 UTC (permalink / raw)
bubble <j.j.b.weinberg@hccnet.nl> 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 <string.h>
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Cxx Compile error
2000-04-27 4:00 ` bubble
@ 2000-04-27 4:00 ` Alex Rhomberg
2000-04-27 4:00 ` Aaron Sawyer
1 sibling, 0 replies; 9+ messages in thread
From: Alex Rhomberg @ 2000-04-27 4:00 UTC (permalink / raw)
bubble wrote:
> > cxx: Error: Icon.cc, line 137: identifier "strcmp" is undefined
> > if (strcmp(name, "Unnamed")) {
> > ____________^
> So am i to conclude that something needs to be defined for strcmp
> aswell?
> If so what would that be?
In such a case, you consult the manpage for strcmp:
man strcmp
It says:
#include <string.h>
int strcmp(const char *s1, const char *s2);
Make sure that string.h is included somewhere.
- Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Cxx Compile error
2000-04-27 4:00 ` bubble
2000-04-27 4:00 ` Alex Rhomberg
@ 2000-04-27 4:00 ` Aaron Sawyer
2000-04-27 4:00 ` bubble
1 sibling, 1 reply; 9+ messages in thread
From: Aaron Sawyer @ 2000-04-27 4:00 UTC (permalink / raw)
bubble wrote:
> bubble wrote:
> > 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.
[snip]
> So am i to conclude that something needs to be defined for strcmp
> as well?
> If so what would that be?
Odd. The quick (though not necessarily correct) fix is to put the line
#include <string.h>
at the beginning of Icon.cc ; this will define strcmp() and other
string manipulation functions.
I would then be asking myself why it was missing (or what other
bits are missing from the compile/link/load/runtime environment)
and hunt... (is there a makefile? was there a README? ... )
HTH,
=Aaron
--
.============================v============================.
| D. Aaron Sawyer : Aaron.Sawyer@IrisSP.AMcom |
| Iris Associates : Voice: +1.978.392.5298 |
| Five Technology Park Drive : Fax: +1.978.392.6669 |
| Westford, MA 01886 : Email: s/SP.AM/./ above |
`============================^============================'
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Cxx Compile error
2000-04-27 4:00 ` Aaron Sawyer
@ 2000-04-27 4:00 ` bubble
2000-04-27 4:00 ` Tony Hammitt
0 siblings, 1 reply; 9+ messages in thread
From: bubble @ 2000-04-27 4:00 UTC (permalink / raw)
Aaron Sawyer wrote:
>
> bubble wrote:
> > bubble wrote:
> > > 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.
> [snip]
> > So am i to conclude that something needs to be defined for strcmp
> > as well?
> > If so what would that be?
>
> Odd. The quick (though not necessarily correct) fix is to put the line
>
> #include <string.h>
>
> at the beginning of Icon.cc ; this will define strcmp() and other
> string manipulation functions.
>
> I would then be asking myself why it was missing (or what other
> bits are missing from the compile/link/load/runtime environment)
> and hunt... (is there a makefile? was there a README? ... )
>
> HTH,
> =Aaron
> --
> .============================v============================.
> | D. Aaron Sawyer : Aaron.Sawyer@IrisSP.AMcom |
> | Iris Associates : Voice: +1.978.392.5298 |
> | Five Technology Park Drive : Fax: +1.978.392.6669 |
> | Westford, MA 01886 : Email: s/SP.AM/./ above |
> `============================^============================'
Hi,
Thanks for your reply Aaron and Alex.
These are very saine question i need to learn to ask myself when
confronted with problems like these.
Could you specify how I would hunt. Should I use ladebug to debug try
lclint to look for errors in the source.
See the thing is that blackbox does compile using g++, just not when
using cxx.
I was sifting through documents included in the cxx release but couldn't
find the precise awnser.
I tried several extra compile options to now avail.
But yeah I could have looked for string.h :).
It is indeed an important question why wasn't it included ?
Could it be that g++ isn't that strict, compared to cxx?
Anyway thanks for your help
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Cxx Compile error
2000-04-27 4:00 ` Martin Sinot
@ 2000-04-27 4:00 ` bubble
0 siblings, 0 replies; 9+ messages in thread
From: bubble @ 2000-04-27 4:00 UTC (permalink / raw)
Martin Sinot wrote:
>
> bubble <j.j.b.weinberg@hccnet.nl> 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 <string.h>
>
> 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
Hi
Eey there I go, here's the awnser.
Thanks very much
Jigal
Rotterdam,Netherlands.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Cxx Compile error
2000-04-27 4:00 Cxx Compile error bubble
2000-04-27 4:00 ` bubble
2000-04-27 4:00 ` Martin Sinot
@ 2000-04-27 4:00 ` bubble
2 siblings, 0 replies; 9+ messages in thread
From: bubble @ 2000-04-27 4:00 UTC (permalink / raw)
bubble wrote:
>
> 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
He seems that just the addition of #include "string.h" was enough to
succesfully compile blackbox.
Now I tried using ccc on nmap this is even worse.
Is it really the case that ccc is being so strict compared to gcc?
By the way is there anyone who compiled nmap succesfully using ccc?
oke that was it.
Thanks for your trouble.
Greetz
Jigal
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Cxx Compile error
2000-04-27 4:00 ` bubble
@ 2000-04-27 4:00 ` Tony Hammitt
0 siblings, 0 replies; 9+ messages in thread
From: Tony Hammitt @ 2000-04-27 4:00 UTC (permalink / raw)
bubble wrote:
>
> Aaron Sawyer wrote:
> >
> > bubble wrote:
> > > bubble wrote:
> > > > 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.
> > [snip]
> > > So am i to conclude that something needs to be defined for strcmp
> > > as well?
> > > If so what would that be?
> >
> > Odd. The quick (though not necessarily correct) fix is to put the line
> >
> > #include <string.h>
> >
> > at the beginning of Icon.cc ; this will define strcmp() and other
> > string manipulation functions.
> >
> > I would then be asking myself why it was missing (or what other
> > bits are missing from the compile/link/load/runtime environment)
> > and hunt... (is there a makefile? was there a README? ... )
> >
> > HTH,
> > =Aaron
> > --
> > .============================v============================.
> > | D. Aaron Sawyer : Aaron.Sawyer@IrisSP.AMcom |
> > | Iris Associates : Voice: +1.978.392.5298 |
> > | Five Technology Park Drive : Fax: +1.978.392.6669 |
> > | Westford, MA 01886 : Email: s/SP.AM/./ above |
> > `============================^============================'
>
> Hi,
>
> Thanks for your reply Aaron and Alex.
>
> These are very saine question i need to learn to ask myself when
> confronted with problems like these.
> Could you specify how I would hunt. Should I use ladebug to debug try
> lclint to look for errors in the source.
> See the thing is that blackbox does compile using g++, just not when
> using cxx.
> I was sifting through documents included in the cxx release but couldn't
> find the precise awnser.
> I tried several extra compile options to now avail.
> But yeah I could have looked for string.h :).
> It is indeed an important question why wasn't it included ?
> Could it be that g++ isn't that strict, compared to cxx?
>
> Anyway thanks for your help
It is very simple, for every function that it complains about,
type 'man <function name>' like 'man strcmp'. Sometimes this
gives you the wrong manual section, in which case try
'man 3 <function name>' At the top of the manual page is a
list of files that must be included for the function to be
prototyped correctly, like '#include <string.h>' in this case.
Real soon now, I'll have my website exampleprograms.org up and
running, which I intend to be a place that answers questions
like these with documented code examples. People will be able
to make requests for programs, which other visitors can fulfil.
I don't want to advertise too much here, but I did answer your
question.
Regards,
Tony Hammitt
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2000-04-27 4:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-04-27 4:00 Cxx Compile error bubble
2000-04-27 4:00 ` bubble
2000-04-27 4:00 ` Alex Rhomberg
2000-04-27 4:00 ` Aaron Sawyer
2000-04-27 4:00 ` bubble
2000-04-27 4:00 ` Tony Hammitt
2000-04-27 4:00 ` Martin Sinot
2000-04-27 4:00 ` bubble
2000-04-27 4:00 ` bubble
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox