LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ssize_t being redefined in cvidef.h

Solved!
Go to solution

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?

0 Kudos
Message 1 of 5
(2,785 Views)

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. "

 

0 Kudos
Message 2 of 5
(2,724 Views)

It is defined in /usr/include/sys/types.h and /usr/local/natinst/cvi2013/include/cvidef.h.

0 Kudos
Message 3 of 5
(2,716 Views)
Solution
Accepted by topic author DesertBroncoFan

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.

 

0 Kudos
Message 4 of 5
(2,698 Views)

Thanks, I didn't see that before.

 

I'll give that a try and see what happens.

0 Kudos
Message 5 of 5
(2,687 Views)