a note about building cgi-3.2.2 under RH7.3 (and gcc 2.96)
"g.p.ciceri" <[email protected]> Wed, 13 Aug 2003 11:29:15 +0200
| Newsgroups | gmane.comp.gcc.cgicc.general |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
I've tried to build cgicc under Redhat 7.3
(with the old compiler gcc 2.96).
I take the following error
---
g++ -DHAVE_CONFIG_H -I. -I. -I. -I.. -I.. -Wall -W -pedantic -g -O2
-MT CgiEnvironment.lo -MD -MP -MF .deps/CgiEnvironment.Tpo -c
CgiEnvironment.cpp -fPIC -DPIC -o .libs/CgiEnvironment.o
CgiEnvironment.cpp: In method `void cgicc::CgiEnvironment::parseCookie
(const string &)':
CgiEnvironment.cpp:141: parse error before `__ctype_b'
CgiEnvironment.cpp:141: parse error before `]'
CgiEnvironment.cpp:149: confused by earlier errors, bailing out
make[2]: *** [CgiEnvironment.lo] Error 1
---
Googling here and there, I've found a note:
http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/porting-howto.html
stating issues for Libc-macros and old implementations of libstdc++
(like the one in g++ 2.96). One proposed solution was not to use
<cctype> and std:: namespace but revert to the C <ctype.h>.
So I've switched for gcc 2.x to the C
behaviour with some #if... #endif in two places.
First, to select the right include
(CgiEnvironment.cpp, about row 26)
---
#if (__GNUG__ == 2)
// for old g++ v2.96, we use ctype.h
# include <ctype.h>
#else
# include <cctype>
#endif
---
Second, to choose the right isspace call
(CgiEnvironment.cpp, about row 141)
---
#if (__GNUG__ == 2)
// for old g++ v2.96, we use ctype.h
if(isspace(*data_iter) == 0)
#else
if(sdt::isspace(*data_iter) == 0)
#endif
---
Now all seems to build well. Demos run.
I've not tested back on gcc 3.x, however.
Any remark will be appreciated.
HTH
Regards
/gp