public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: isalnum not declared CODE
@ 2004-06-16  8:50 Nikolai Nezlobin
  2004-06-16 12:14 ` Eljay Love-Jensen
  2004-06-16 12:40 ` Claudio Bley
  0 siblings, 2 replies; 3+ messages in thread
From: Nikolai Nezlobin @ 2004-06-16  8:50 UTC (permalink / raw)
  To: llewelly; +Cc: gcc-help

Dear All,

This is the short version of the code that produces the isalnum error.  The
files (agstring.h, CType.h, main.cc, makefile, makefile.common) and two
error messages (for the short code and for the whole project) are below.

All files, except for makefile.common, were in /mnt/hdb1/Sour/CType. The
line top=/mnt/hdb1/Sour in makefile reflects this. You will need to change
the top= if you try to compile the code.
makefile.common was kept one level upper (in /mnt/hdb1/Sour)

Thanks,
Nikolai

****************mnt/hdb1/Sour/CType/agstring.h******************************
**
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
    written by Doug Lea (dl@rocky.oswego.edu)
*/

#ifndef _String_h
#define _String_h 1
#include <iostream.h>
#undef OK
#define INLINE

struct StrRep                     // internal String representations
{
  unsigned short    len;
  unsigned short    sz;
  char              s[1];
};

class String
{
protected:
  StrRep*           rep;   // Strings are pointers to their representations
public:
                    String();
                    String(const char* t);
                    ~String();
  String&           operator =  (const char* y);
  friend INLINE ostream&   operator<<(ostream& s, const String& x);
};
INLINE ostream& operator<<(ostream& s, const String& x);
#endif


******************mnt/hdb1/Sour/CType/CType.h*******************************
****
#ifndef CType_h
#define CType_h
#include "agstring.h"
typedef enum { C_Node_Phi=0} CType;
const int CType_num=1;
const String CType_string[CType_num]={"Node_Phi"};
#endif


*********************mnt/hdb1/Sour/CType/main.cc****************************
****
#include "CType.h"
#include "agstring.h"
int main(){
for(int i=0;i<CType_num;i++)
cout << i << " " << CType_string[i] << endl;
}


**********************mnt/hdb1/Sour/CType/makefile**************************
*****
top=..
top_relative:=$(top)
CC=$(CXX)
CFLAGS=-g -v -Wall
DEPENDFLAG=-MMD
LD=$(CXX)
LDFLAGS=-g -v -Wall
LDLIBS=-lm
top=/mnt/hdb1/Sour
cty_dir = $(top)/CType
cty_objs=$(addprefix $(cty_dir)/,agstring.o)
dep_dir = $(cty_dir)
my_target=try
my_objs = main.o
#INCLUDE=$(addprefix -I,$(dep_dir))
INCLUDE=
empty:=
collon:= :
space:= $(empty) $(empty)
export CPLUS_INCLUDE_PATH:=$(subst $(space),$(collon),$(dep_dir))
include $(top)/Makefile.common


**********************mnt/hdb1/Sour/makefile.common*************************
******
my_objs_relative:=$(strip $(subst $(top),$(top_relative),$(my_objs)))
all:
$(MAKE) $(my_target)
$(my_target): $(my_objs)
$(LD) $(LDFLAGS) -o $@ $(my_objs_relative) $(LDLIBS)


***************Error Message for the Short Code*******************
root@nezlobin:/mnt/hdb1/Sour/CType# make
make try
make[1]: Entering directory `/mnt/hdb1/Sour/CType'
g++ -c -o main.o main.cc
In file included from /usr/include/c++/3.2.3/backward/iostream.h:31,
from agstring.h:9,
from CType.h:4,
from main.cc:1:
/usr/include/c++/3.2.3/backward/backward_warning.h:32:2: warning: #warning
This file includes at least one deprecated or antiquated header. Please
consider using one of the 32 headers found in section 17.4.1.2 of the C++
standard. Examples include substituting the <X> header for the <X.h> header
for C++ includes, or <sstream> instead of the deprecated header
<strstream.h>. To disable this warning use -Wno-deprecated.
In file included from /usr/include/c++/3.2.3/bits/localefwd.h:48,
from /usr/include/c++/3.2.3/ios:48,
from /usr/include/c++/3.2.3/ostream:45,
from /usr/include/c++/3.2.3/iostream:45,
from /usr/include/c++/3.2.3/backward/iostream.h:32,
from agstring.h:9,
from CType.h:4,
from main.cc:1:
/usr/include/c++/3.2.3/cctype:68: `isalnum' not declared
/usr/include/c++/3.2.3/cctype:69: `isalpha' not declared
/usr/include/c++/3.2.3/cctype:70: `iscntrl' not declared
/usr/include/c++/3.2.3/cctype:71: `isdigit' not declared
/usr/include/c++/3.2.3/cctype:72: `isgraph' not declared
/usr/include/c++/3.2.3/cctype:73: `islower' not declared
/usr/include/c++/3.2.3/cctype:74: `isprint' not declared
/usr/include/c++/3.2.3/cctype:75: `ispunct' not declared
/usr/include/c++/3.2.3/cctype:76: `isspace' not declared
/usr/include/c++/3.2.3/cctype:77: `isupper' not declared
/usr/include/c++/3.2.3/cctype:78: `isxdigit' not declared
/usr/include/c++/3.2.3/cctype:79: `tolower' not declared
/usr/include/c++/3.2.3/cctype:80: `toupper' not declared
In file included from /usr/include/c++/3.2.3/bits/locale_facets.h:63,
from /usr/include/c++/3.2.3/bits/basic_ios.h:41,
from /usr/include/c++/3.2.3/ios:51,
from /usr/include/c++/3.2.3/ostream:45,
from /usr/include/c++/3.2.3/iostream:45,
from /usr/include/c++/3.2.3/backward/iostream.h:32,
from agstring.h:9,
from CType.h:4,
from main.cc:1:
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:44: `_ISupper'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:45: `_ISlower'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:46: `_ISalpha'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:47: `_ISdigit'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:48:
`_ISxdigit'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:49: `_ISspace'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:50: `_ISprint'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:51: `_ISgraph'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:52: `_IScntrl'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:53: `_ISpunct'
was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:54: `_ISalnum'
was not declared in this scope
make[1]: *** [main.o] Error 1
make[1]: Leaving directory `/mnt/hdb1/Sour/CType'
make: *** [all] Error 2

***************Error Message for the Whole Project*******************
root@nezlobin:/mnt/hdb1/Source/src# make
make st
make[1]: Entering directory `/mnt/hdb1/Source/src'
cd /mnt/hdb1/Source/src/Parser && \
g++ -g -v -Wall -MMD parser.tab.c -c -o parser.tab.o
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/specs
Configured with:
../gcc-3.2.3/configure --prefix=/usr --enable-shared --enable-threads=posix 
--enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i4
86-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.2.3
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/cc1plus -v -MMD
parser.tab.d -MQ
parser.tab.o -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX
_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix
__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLI
NE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__
i386 -D__i386__ -D__tune_i486__
parser.tab.c -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet -dumpbase
parser.tab.c -g -Wall -version -o /tmp/ccDVr3jc.s
GNU CPP version 3.2.3 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.2.3 (i486-slackware-linux)
        compiled by GNU C version 3.2.3.
ignoring nonexistent directory "/usr/i486-slackware-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /mnt/hdb1/Source/src/CType
 /mnt/hdb1/Source/src/Node
 /mnt/hdb1/Source/src/Edge
 /mnt/hdb1/Source/src/Matrix
 /mnt/hdb1/Source/src/Resistor
 /mnt/hdb1/Source/src/Capacitor
 /mnt/hdb1/Source/src/Tunnel
 /mnt/hdb1/Source/src/VSource
 /mnt/hdb1/Source/src/CObserver/Observer/StrArr
 /mnt/hdb1/Source/src/CObserver/Observer/Buffer
 /mnt/hdb1/Source/src/CObserver/Observer
 /mnt/hdb1/Source/src/CObserver
 /mnt/hdb1/Source/src/VSource/IntList
 /mnt/hdb1/Source/src/Iterator
 /mnt/hdb1/Source/src/Parameter
 /mnt/hdb1/Source/src/Manager
 /mnt/hdb1/Source/src/Parser
 /mnt/hdb1/Source/src/CObserver/Bin2asc
 /mnt/hdb1/Source/src
 /usr/include/c++/3.2.3
 /usr/include/c++/3.2.3/i486-slackware-linux
 /usr/include/c++/3.2.3/backward
 /usr/local/include
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/include
 /usr/include
End of search list.
In file included from /usr/include/c++/3.2.3/backward/iostream.h:31,
                 from /mnt/hdb1/Source/src/CType/agstring.h:26,
                 from /mnt/hdb1/Source/src/CType/CType.h:4,
                 from parser.y:7:
/usr/include/c++/3.2.3/backward/backward_warning.h:32:2: warning: #warning
This file includes at least one deprecated or antiquated header. Please
consider using one of the 32 headers found in section 17.4.1.2 of the C++
standard. Examples include substituting the <X> header for the <X.h> header
for C++ includes, or <sstream> instead of the deprecated header
<strstream.h>. To disable this warning use -Wno-deprecated.
In file included from /usr/include/c++/3.2.3/bits/localefwd.h:48,
                 from /usr/include/c++/3.2.3/ios:48,
                 from /usr/include/c++/3.2.3/ostream:45,
                 from /usr/include/c++/3.2.3/iostream:45,
                 from /usr/include/c++/3.2.3/backward/iostream.h:32,
                 from /mnt/hdb1/Source/src/CType/agstring.h:26,
                 from /mnt/hdb1/Source/src/CType/CType.h:4,
                 from parser.y:7:
/usr/include/c++/3.2.3/cctype:68: `isalnum' not declared
/usr/include/c++/3.2.3/cctype:69: `isalpha' not declared
/usr/include/c++/3.2.3/cctype:70: `iscntrl' not declared
/usr/include/c++/3.2.3/cctype:71: `isdigit' not declared
/usr/include/c++/3.2.3/cctype:72: `isgraph' not declared
/usr/include/c++/3.2.3/cctype:73: `islower' not declared
/usr/include/c++/3.2.3/cctype:74: `isprint' not declared
/usr/include/c++/3.2.3/cctype:75: `ispunct' not declared
/usr/include/c++/3.2.3/cctype:76: `isspace' not declared
/usr/include/c++/3.2.3/cctype:77: `isupper' not declared
/usr/include/c++/3.2.3/cctype:78: `isxdigit' not declared
/usr/include/c++/3.2.3/cctype:79: `tolower' not declared
/usr/include/c++/3.2.3/cctype:80: `toupper' not declared
In file included from /usr/include/c++/3.2.3/bits/locale_facets.h:63,
                 from /usr/include/c++/3.2.3/bits/basic_ios.h:41,
                 from /usr/include/c++/3.2.3/ios:51,
                 from /usr/include/c++/3.2.3/ostream:45,
                 from /usr/include/c++/3.2.3/iostream:45,
                 from /usr/include/c++/3.2.3/backward/iostream.h:32,
                 from /mnt/hdb1/Source/src/CType/agstring.h:26,
                 from /mnt/hdb1/Source/src/CType/CType.h:4,
                 from parser.y:7:
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:44: `_ISupper'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:45: `_ISlower'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:46: `_ISalpha'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:47: `_ISdigit'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:48:
`_ISxdigit'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:49: `_ISspace'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:50: `_ISprint'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:51: `_ISgraph'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:52: `_IScntrl'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:53: `_ISpunct'
   was not declared in this scope
/usr/include/c++/3.2.3/i486-slackware-linux/bits/ctype_base.h:54: `_ISalnum'
   was not declared in this scope
In file included from parser.y:9:
/mnt/hdb1/Source/src/VSource/Sinusoid.h:20: default argument given for
   parameter 3 of `Sinusoid::Sinusoid(double, double, double =
   0x0000000000000000000000000000000000000000)'
/mnt/hdb1/Source/src/VSource/Sinusoid.h:8: after previous specification in `
   Sinusoid::Sinusoid(double, double, double =
   0x0000000000000000000000000000000000000000)'
make[1]: *** [/mnt/hdb1/Source/src/Parser/parser.tab.o] Error 1
make[1]: Leaving directory `/mnt/hdb1/Source/src'
make: *** [all] Error 2



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: isalnum not declared CODE
  2004-06-16  8:50 isalnum not declared CODE Nikolai Nezlobin
@ 2004-06-16 12:14 ` Eljay Love-Jensen
  2004-06-16 12:40 ` Claudio Bley
  1 sibling, 0 replies; 3+ messages in thread
From: Eljay Love-Jensen @ 2004-06-16 12:14 UTC (permalink / raw)
  To: Nikolai Nezlobin, llewelly; +Cc: gcc-help

Hi Nicolai,

Your example (with some tweaking) worked on my platform.

My platform is Cygwin / WinXPpro (NT 5.1sp1a) and GCC 3.3.1 (cygming special).

The tweaking should be immaterial.  Things like putting in function bodies 
for String, changing #include <iostream.h> to #include <iostream>, adding 
in "std::" prefixes in the few spots they're needed, changing where top 
points to in the makefile.

Keep in mind that ctype.h is not part of GCC; it's supplied by your 
distribution (Slackware).

It appears that either your GCC was built for a different version of Slackware,
or... you have a filename collision (perhaps due to case insensitive 
filesystem?)
or... you could try putting #include <cctype> in your main.cc

Generally speaking, it's bad practice to name your project's header files 
the same as the system header files.  Even if they differ in case, such as 
<ctype.h> versus "CType.h".

Try this:
g++ -E -dI -c main.cc

That should show you if you are actually including the Slackware 
/usr/include/ctype.h as you expect.  I suspect you are not getting what you 
think you should be getting.

Sincerely,
--Eljay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: isalnum not declared CODE
  2004-06-16  8:50 isalnum not declared CODE Nikolai Nezlobin
  2004-06-16 12:14 ` Eljay Love-Jensen
@ 2004-06-16 12:40 ` Claudio Bley
  1 sibling, 0 replies; 3+ messages in thread
From: Claudio Bley @ 2004-06-16 12:40 UTC (permalink / raw)
  To: gcc-help

On Wed, Jun 16, 2004 at 03:49:18AM -0500, Nikolai Nezlobin wrote:
> Dear All,

Hello Nikolai,
 
> This is the short version of the code that produces the isalnum error.  The
> files (agstring.h, CType.h, main.cc, makefile, makefile.common) and two
> error messages (for the short code and for the whole project) are below.
> 
> All files, except for makefile.common, were in /mnt/hdb1/Sour/CType. The
> line top=/mnt/hdb1/Sour in makefile reflects this. You will need to change
> the top= if you try to compile the code.
> makefile.common was kept one level upper (in /mnt/hdb1/Sour)

The code you've posted works for me (albeit it would've been probably easier/better
if you just had attached a tarball so that one wouldn't need to fiddle with
the (badly formatted) "code text").

It did compile with GCC 3.2.3 and GCC 3.4 (both directly downloaded from a GNU mirror; 
i.e. no additional patches) and Redhat's GCC 2.96 on RH7.3 (installed from a RPM).

Either your distribution (it seems you're running a Slackware system and I don't have
any experience/knowledge about Slackware) has added a few patches and thereby 
unfortunately some bugs creeped in OR (what I suspect) something else gets in the
way before the right header is included (you don't have by chance a file named "ctype.h"
lying around somewhere in your source dir?). OR it's something completely different...

You can just run your code trough the C pre processor:

g++ -E main.cc > main.ii

Then, have a look at the main.ii file. 
Does it contain references to /usr/include/ctype.h? E.g:

# 1 "/usr/include/ctype.h" 1 3

If it does, is there some code which reads

extern int isalnum (int) throw ();

???

It should be there. Usually. ;-) 

Maybe you can try upgrading your compiler? I mean, GCC 3.2.3 is already a bit
dated. 

-- 
claudio

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-06-16 12:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-16  8:50 isalnum not declared CODE Nikolai Nezlobin
2004-06-16 12:14 ` Eljay Love-Jensen
2004-06-16 12:40 ` Claudio Bley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).