07-24-2019 06:05 PM
I'm in the process of porting an existing program from Windows 10 to Linux (RHEL 6.9) that uses LabWindows/CVI and have an issue on the Linux side where I'm getting an error stating that ssize_t is being redefined in cvidef.h. I'm using the CVI RTE 2013 for Linux and am not sure how to get around this problem as ssize_t is defined in /usr/include/sys/types.h in G++.
Is this a known issue and if so, how do I get around it? If it's not, are there any ideas on how to get around this?
Solved! Go to Solution.
07-29-2019 02:11 PM
Where else is ssize_t being defined? This was new to me, so I had to look it up:
"Additionally, POSIX includes ssize_t
, which is a signed integral type of the same width as size_t
. "
07-29-2019 02:16 PM
It is defined in /usr/include/sys/types.h and /usr/local/natinst/cvi2013/include/cvidef.h.
07-30-2019 08:03 AM
The CVI code has #ifdefs around it that control whether or not this is defined:
#if !defined(_SSIZE_T_DEFINED) && !defined(__ssize_t_defined) #define _SSIZE_T_DEFINED #ifdef _NI_mswin64_ typedef __int64 ssize_t; #else typedef int ssize_t; #endif #endif
You may be able to simply define that before you #include, that way the CVI code will not include its own definition (assuming the one in types.h is correct for your use). Just stick this before you start including files:
#define _SSIZE_T_DEFINED
#include <…..files after this....>
I am looking at a Windows system, so there may be a similar ifdef in your types.h, so you could go the other way, if so.
07-30-2019 09:30 AM
Thanks, I didn't see that before.
I'll give that a try and see what happens.