03-24-2021 03:58 PM
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>
Solved! Go to Solution.
03-25-2021 03:59 AM
Are you getting this from a new and blank "Hello world" project, or from a complex behemoth with plenty ot #defines and weird #includes ?
03-25-2021 08:30 AM
Complex behemoth
03-26-2021 06:08 AM - edited 03-26-2021 06:09 AM
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.