Pelles C forum

C language => Beginner questions => Topic started by: Jerry on November 11, 2025, 07:07:32 PM

Title: Error #2158 Unrecognized type 'ssize_t'
Post by: Jerry on November 11, 2025, 07:07:32 PM
Dear all,

I am working on adding a graphical user interface to one of my curve-fitting (https://github.com/zhongrui7/Particle-Swarm-Optimization-approach/blob/main/pso_PVIV_fit0.c) codes. The code compiles and runs correctly with several other compilers (CodeBlocks 2025, Visual Studio, Intel OneAPI, and GCC), but Pelles C reports the following error:

Error #2158: Unrecognized type 'ssize_t'


I have already checked previous discussions on this forum and tried the common suggestions, including adding:

#include <sys/types.h>
#define __STDC_WANT_LIB_EXT2__ 1


Unfortunately, the error persists.

Does anyone know how to properly enable or define ssize_t in Pelles C? My understanding is that ssize_t should be available by default, as it is in the other compilers I have tested.

Any suggestions or guidance would be greatly appreciated. Thank you.
Title: Re: Error #2158 Unrecognized type 'ssize_t'
Post by: TimoVJL on November 11, 2025, 08:20:13 PM
Quote/Go Accepts 'old' names for C runtime functions.
#ifndef _SSIZE_T_DEFINED
#define _SSIZE_T_DEFINED
typedef __SSIZE_TYPE__ _ssize_t;
#ifdef __POCC__OLDNAMES
typedef __SSIZE_TYPE__ ssize_t;
#endif /* __POCC__OLDNAMES */
#endif /* SSIZE_T_DEFINED */
Title: Re: Error #2158 Unrecognized type 'ssize_t'
Post by: Jerry on November 12, 2025, 04:26:52 PM
Quote from: TimoVJL on November 11, 2025, 08:20:13 PM
Quote/Go Accepts 'old' names for C runtime functions.
#ifndef _SSIZE_T_DEFINED
#define _SSIZE_T_DEFINED
typedef __SSIZE_TYPE__ _ssize_t;
#ifdef __POCC__OLDNAMES
typedef __SSIZE_TYPE__ ssize_t;
#endif /* __POCC__OLDNAMES */
#endif /* SSIZE_T_DEFINED */

Thank you for the suggestion. But the problem persists even after adding the lines to my code.
I think this might be a bug with Pelles C (current version 13.00), as other compilers work fine with my code.
Title: Re: Error #2158 Unrecognized type 'ssize_t'
Post by: TimoVJL on November 12, 2025, 04:32:30 PM
Not a bug.
Don't add that code example.

Just add -Go to pocc commandline, if you don't use poide or add in poide compiler options Define compatbility names
Title: Re: Error #2158 Unrecognized type 'ssize_t'
Post by: John Z on November 12, 2025, 05:51:51 PM
Jerry,

If you are using the IDE check the box in the picture.  This will add /Go to the compile
flags (CFLAGS).

John Z
Title: Re: Error #2158 Unrecognized type 'ssize_t'
Post by: Jerry on November 12, 2025, 10:43:11 PM
Quote from: John Z on November 12, 2025, 05:51:51 PMJerry,

If you are using the IDE check the box in the picture.  This will add /Go to the compile
flags (CFLAGS).

John Z
Thank you, John and TimoVJL! The problem is solved!