This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc and ctype.h



--- cygwin@mail.cnz.com wrote: > I have just installed cygwin and have used it
to develop a small Win32
> utility.
> Everything was working amazingly well until I tried to use some of the
> functions
> from ctype.h (isspace, tolower).
> 
> $ make
> gcc -e _mainCRTStartup -mno-cygwin -mwindows main.o errlog.o main.res -o
> main.ex
> e -lrasapi32
> main.o(.text+0x1f87):main.cpp: undefined reference to `_imp___ctype_'
> main.o(.text+0x1fb1):main.cpp: undefined reference to `_imp___ctype_'
> collect2: ld returned 1 exit status
> make: *** [main.exe] Error 1
> 
> I added -lc to link in the ctype functions, and it compiled fine, but now the
> program just hangs (the initial window does not even display).  This happens
> even if I never actually call the function that is using isspace and tolower,
> so
> it is not a problem introduced by the code itself.
> 
> If I leave it running long enough, I get this error:
> 
> MAIN caused a stack fault in module KERNEL32.DLL at 0167:bff9db61.
> Registers:
> EAX=c00309c4 CS=0167 EIP=bff9db61 EFLGS=00010202
> EBX=0254ff68 SS=016f ESP=00551db0 EBP=0055204c
> ECX=00000000 DS=016f ESI=00000000 FS=2e3f
> EDX=bff76855 ES=016f EDI=bff79138 GS=0000
> Bytes at CS:EIP:
> 53 8b 15 e4 9c fc bf 56 89 4d e4 57 89 4d dc 89 
> Stack dump:
> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
> 
> If I remove no-cygwin it will work, but now I need cygwin1.dll, and I really
> need this to be a self-contained EXE.  I have experimented with -static, but
> it
> still wants cygwin1.dll.
> 
> Any suggestions on how to do this?
> 
> Lyle Frost
> Citadel Consulting
> http://www.cnz.com
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
> 

What ctype.h are you including, mingw's or cygwin's?  
(put a -H in your compile command to find out.)  
The mingw ctype.h makes no reference to _ctype_[].
Cygwins ctype.h declares _ctype_ as a dllimported var.

I suspect that gcc is including the wrong ctype.h, which indicates an
installation problem.

Danny 

_____________________________________________________________________________
http://messenger.yahoo.com.au - Yahoo! Messenger
- Voice chat, mail alerts, stock quotes and favourite news and lots more!

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]