got 'strrchr' undefined even I include stdlib.h 
Author Message
 got 'strrchr' undefined even I include stdlib.h

I'm developing wince3.0 program by EVC.
In my hpc2000 sdk, the strrchr function is defined
in stdlib.h as:

_CRTIMP char *  __cdecl strrchr(const char *, int);

however, even I include <stdlib.h> in my program,
the compiler still say:

'strrchr' undefined; assuming extern returning int

Even I declare the prototype explicitely, I still
got error while linking program.
Why?



Wed, 03 Sep 2003 18:02:37 GMT  
 got 'strrchr' undefined even I include stdlib.h
I find strchr defined in string.h (but I'm still using the CE tools for VC
5). I don't think I've ever linked it, so I'm not sure which library
contains it.

Are you sure you want strchr, rather than wcschr (or _tcschr)?

--
-----------------------------------------
To reply to me, remove the underscores (_) from my email address.

Robert E. Zaret
PenFact, Inc.
46 Beach Street
Boston, MA 02111
www.penfact.com

Quote:

>I'm developing wince3.0 program by EVC.
>In my hpc2000 sdk, the strrchr function is defined
>in stdlib.h as:

>_CRTIMP char *  __cdecl strrchr(const char *, int);

>however, even I include <stdlib.h> in my program,
>the compiler still say:

>'strrchr' undefined; assuming extern returning int

>Even I declare the prototype explicitely, I still
>got error while linking program.
>Why?



Sat, 06 Sep 2003 06:18:31 GMT  
 got 'strrchr' undefined even I include stdlib.h
He actually said 'strrchr' and I can't find it anywhere either.
Is it so hard to write one?

Cheers

Cy


Quote:
> I find strchr defined in string.h (but I'm still using the CE tools for VC
> 5). I don't think I've ever linked it, so I'm not sure which library
> contains it.

> Are you sure you want strchr, rather than wcschr (or _tcschr)?

> --
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address.

> Robert E. Zaret
> PenFact, Inc.
> 46 Beach Street
> Boston, MA 02111
> www.penfact.com


> >I'm developing wince3.0 program by EVC.
> >In my hpc2000 sdk, the strrchr function is defined
> >in stdlib.h as:

> >_CRTIMP char *  __cdecl strrchr(const char *, int);

> >however, even I include <stdlib.h> in my program,
> >the compiler still say:

> >'strrchr' undefined; assuming extern returning int

> >Even I declare the prototype explicitely, I still
> >got error while linking program.
> >Why?



Sat, 06 Sep 2003 18:32:07 GMT  
 got 'strrchr' undefined even I include stdlib.h
Shouldn't be, if you have the CRT source from MSVC++ 6 handy ;-)


Quote:
> He actually said 'strrchr' and I can't find it anywhere either.
> Is it so hard to write one?

> Cheers

> Cy



Sat, 06 Sep 2003 21:52:13 GMT  
 got 'strrchr' undefined even I include stdlib.h
I would hope you can write your own strrchr without referring to the CRT
source...

template <typename chartype>
chartype* mystrrchr(chartype* str, chartype c) {
  chartype* begin = str;  //preserve start of string

  while (*str) ++str; //seek end of string

  //seek backwards through string until target
  //found or beginning passed
  //comparison with begin must short circuit
  //target comparison, as not to dereference
  //an illegal pointer (begin-1)
  while ((str >= begin) && (*str != c)) --str;

  if (str < begin) return NULL; //not found
  else return str;

Quote:
}

(off the top of my head...not actually tested)

Ken


Quote:
> Shouldn't be, if you have the CRT source from MSVC++ 6 handy ;-)



> > He actually said 'strrchr' and I can't find it anywhere either.
> > Is it so hard to write one?



Sun, 07 Sep 2003 20:20:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. getting CSliderCtrl to notify even when value hasn't changed

2. gnu's malloc.h and NeXT's stdlib.h: conflicting types for mstats

3. Undefined symbol 'identifier'

4. undefined reference to 'main'

5. Undefined reference to function 'sqrt()'

6. Help, undefined reference to 'sqrt'

7. Question about 'undefined behaviour'

8. 'The symbol is undefined'

9. 'The symbol is undefined'

10. use of undefined type 'CExploreView'

11. error C2504: 'CDialog' : base class undefined

12. Thanks for 'rindex' == 'strrchr' definition

 

 
Powered by phpBB® Forum Software