Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssize_t is undefined [duplicate]

Tags:

c

posix

gnu

In my code I'm using ssize_t but when I try to compile project I got error: unknown type name ‘ssize_t’; did you mean ‘size_t’?

To compile project I'm using cc -std=c11 -O3 I'm including stdint.h and I've also tried stddef.h and others.

Do I have to use some flags or what?

like image 397
Jadw1 Avatar asked May 12 '19 13:05

Jadw1


1 Answers

The "signed-size_t" is not part of standard C, instead it's specific to POSIX (Unix, BSD, Linux, etc) and it's in sys/types.h:

https://pubs.opengroup.org/onlinepubs/7908799/xsh/systypes.h.html

On Windows, ssize_t is not defined but SSIZE_T is - but I assume you're on a POSIX system.

like image 61
Dai Avatar answered Nov 05 '22 21:11

Dai