Hi, I know this is kind of a specialized question, but a lot of good coders read this forum so …
I’m trying to compile an application program, not my own work, and the compiler is unexpectedly whining:
‘ssize_t’ undeclared (first use in this function)
( the actual line being: ssize_t expected_limit = 0; )
Now how is this? I’m under the vague impression that ssize_t is a pretty standard type, declared in types.h, maybe?
On Mon, 09 Jan 2012 17:26:03 +0000, maabaum wrote:
> Hi, I know this is kind of a specialized question, but a lot of good
> coders read this forum so …
>
> I’m trying to compile an application program, not my own work, and the
> compiler is unexpectedly whining:
> ‘ssize_t’ undeclared (first use in this function)
>
> ( the actual line being: ssize_t expected_limit = 0; )
>
> Now how is this? I’m under the vague impression that ssize_t is a pretty
> standard type, declared in types.h, maybe?
You might ask in the programming/scripting forum, though if memory
serves, the “sizeof()” function can tell you what you want to know.
On 01/09/2012 05:16 PM, pixecs wrote:
>
>> Now how is this? I’m under the vague impression that ssize_t is a pretty
>> standard type, declared in types.h, maybe?
>
> Yes indeed ssize_t should be declared in<sys/types.h>, so add
> Code:
> --------------------
> #include<sys/types.h>
> --------------------
> to the beginnig of the file (if is not already there)
That header file should do, but if not, the kernel defines ssize_t to be as follows:
#if __BITS_PER_LONG != 64
typedef int ssize_t;
#else
typedef long ssize_t;
#endif
Actually it’s probably <unistd.h> that he should be including, since ssize_t is the return value of various functions in the standard library which are what the program probably uses, whereas <sys/types.h> relates to internal kernel types.
Thank you all for the help. I was having trouble figuring out which .h file is which.
This is actually something of an installation puzzle. I spared you the details earlier, but in brief, I tried to build this program on two different machines with very similar (AMD64) architectures. The only major difference is that one is running openSuse 12.1 and the other 11.4. The build on 12.1 worked without incident, the 11.4 version had this problem with ssize_t.
Right now I’m trying to figure out what exactly could be different between the two cases that would cause a problem with that declaration – and apparently only that declaration. I mean, if a bunch of things had blown up, well, you’d say, “The fool has obviously forgotten to install a devel package of some sort…” But only that one???