LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Compilation error: stdlib.h vs stdlibex.h

Solved!
Go to solution

Hello, 

 

I am trying to compile a project and I get this error chain:

 

"ansi_c.h"(36,1) In file included from c:\engtools\ni2017\labwindows 2017\include\ansi_c.h:36:
"stdlibex.h"(43,3) error: typedef redefinition with different types ('struct lldiv_t' vs 'struct _lldiv_t')
"stdlib.h"(291,3) note: previous definition is here

 

I looked at the header files and stdlibex.h defines the typedef as follows:

 

typedef struct {
__int64 quot;
__int64 rem;
} lldiv_t;

 

and stdlib.h as follows

 

typedef struct _lldiv_t
{
long long quot;
long long rem;
} lldiv_t;

 

Why is the NI ansi_c.h creating this error? The following is taken from the ansi_c.h file:

 

#include <stdlib.h>
#if defined (_CVI_) || (defined (_NI_linux_) && _NI_linux_)
#include <stdlibex.h>
0 Kudos
Message 1 of 4
(1,372 Views)

Are you getting this from a new and blank "Hello world" project, or from a complex behemoth with plenty ot #defines and weird #includes ?

0 Kudos
Message 2 of 4
(1,329 Views)

Complex behemoth

0 Kudos
Message 3 of 4
(1,320 Views)
Solution
Accepted by topic author TestEngineer11

long long is the Unix convention for 64-bit integers. __int64 is the MS Visual C one, which added it in 2003/2005 as non conformant internal datatype. So there is most likely some #if defs around those declarations and your behemoth messes with them somehow in ways that these headers are not meant to deal with.

 

Try first with a simple program that includes a minimal set of headers besides that ansi_c.h then move up from there to try to find the culprit. Sometimes changing orders of includes can solve such issues. It of course should not happen, but if you mix and match headers from more than one source (and I'm sure you have your own project headers and quite likely several 3rd party library headers) there is always the chance for some clash between them.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(1,304 Views)