Mail Archives: cygwin-developers/1999/07/16/21:53:53
I seen this topic discussed, read the archives and I am still confused
about _ctype_
I see that in ctype.h _ctype_ is as follows...
#if !defined(__CYGWIN32__) || defined(__INSIDE_CYGWIN__) ||
defined(_COMPILING_NEWLIB)
extern _CONST char _ctype_[];
#else
extern _CONST char _ctype_[] __declspec(dllimport);
#endif
I take this to mean that for compiled programs, _ctype_ is exported from
cygwin1.dll
I looked at both the dll and the export library and _ctype_ seems to be
there.
I am using the newest snapshots for winsup (July 5 ) and newlib ( July 3
)
So I can't explain the following....
~/devel/: g++ -o inode-test.exe inode-test.cc
/CYGNUS/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/i586-cygwin32/2.95/libstdc++.a(iost
ream.o): In function `skip_ws(streambuf *)':
/homes/khan/src/gcc-2.95/CYGB20/i586-cygwin32/libio/../../../libio/iostream.cc:6
6: undefined reference to `_ctype_'
/CYGNUS/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/i586-cygwin32/2.95/libstdc++.a(iost
ream.o): In function `istream::_rs(char *)':
/homes/khan/src/gcc-2.95/CYGB20/i586-cygwin32/libio/../../../libio/iostream.cc:2
12: undefined reference to `_ctype_'
/CYGNUS/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/i586-cygwin32/2.95/libstdc++.a(iovf
scanf.o): In function `IO_vfscanf':
/homes/khan/src/gcc-2.95/CYGB20/i586-cygwin32/libio/../../../libio/iovfscanf.c:1
56: undefined reference to `_ctype_'
/homes/khan/src/gcc-2.95/CYGB20/i586-cygwin32/libio/../../../libio/iovfscanf.c:1
63: undefined reference to `_ctype_'
/homes/khan/src/gcc-2.95/CYGB20/i586-cygwin32/libio/../../../libio/iovfscanf.c:3
10: undefined reference to `_ctype_'
/CYGNUS/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/i586-cygwin32/2.95/libstdc++.a(iovf
scanf.o):/homes/khan/src/gcc-2.95/CYGB20/i586-cygwin32/libio/../../../libio/iovf
scanf.c:330: more undefined references to `_ctype_' follow
collect2: ld returned 1 exit status
~/devel/:
where inode-test.cc is the following from Mumit Khan..
// inode-test.c: Find the inode given a file.
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cstdio>
#include <iostream>
using namespace std;
int
main (int argc, char *argv[])
{
for (int i = 1; i < argc; i++)
{
struct stat buf1, buf2;
const char *path = argv[i];
cout << "File: " << path << endl;
int result = stat (path, &buf1);
if (result == 0)
{
cout << " STAT() reports:" << endl << " ================"
<< endl;
cout << " st_mode = " << buf1.st_mode << endl;
cout << " st_ino = " << buf1.st_ino << endl;
cout << " st_dev = " << buf1.st_dev << endl;
cout << " st_nlink = " << buf1.st_nlink << endl;
cout << " st_uid = " << buf1.st_uid << endl;
cout << " st_gid = " << buf1.st_gid << endl;
cout << " st_size = " << buf1.st_size << endl;
cout << " st_rdev = " << buf1.st_rdev << endl;
cout << " st_blksize = " << buf1.st_blksize << endl;
cout << " st_blocks = " << buf1.st_blocks << endl;
}
else
{
cerr << "cannot stat " << path;
perror ("stat");
}
result = lstat (path, &buf2);
if (result == 0)
{
cout << " LSTAT() reports:" << endl << " ================"
<< endl;
cout << " st_mode = " << buf2.st_mode << endl;
cout << " st_ino = " << buf2.st_ino << endl;
cout << " st_dev = " << buf2.st_dev << endl;
cout << " st_nlink = " << buf2.st_nlink << endl;
cout << " st_uid = " << buf2.st_uid << endl;
cout << " st_gid = " << buf2.st_gid << endl;
cout << " st_size = " << buf2.st_size << endl;
cout << " st_rdev = " << buf2.st_rdev << endl;
cout << " st_blksize = " << buf2.st_blksize << endl;
cout << " st_blocks = " << buf2.st_blocks << endl;
}
else
{
cerr << "cannot lstat " << path;
perror ("lstat");
}
}
return 0;
}
- Raw text -