LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

assert.h syntax error after migrating CVI 7.x project to CVI 8.0

While migrating an older CVI 7.x project to CVI 8.0, which used to cleanly build a DLL, I get the following compile error:
 
"assert.h"(28,1)   syntax error; found 'void' expecting ';'.
 
Since this is a built-in file that ships with CVI 8.0 (in CVI's "ansi" directory), I never messed with it, and never would.
 
And as far as I can tell, I never called anything from assert.h directly, and I have no idea how to work backwards from this compile error to figure out what is different from before.  I mean, it's not like I can put a breakpoint in there somewhere for the compiler to reveal how I got there, you know?
 
I put a dashed comment on the line where the compile error is located.
 
Can anyone point me in a direction, because I'm dead in the water now.
 
JB
 
 
/*============================================================================*/
/*                        L a b W i n d o w s / C V I                         */
/*----------------------------------------------------------------------------*/
/*    Copyright (c) National Instruments 1987-1999.  All Rights Reserved.     */
/*----------------------------------------------------------------------------*/
/*                                                                            */
/* Title:       assert.h                                                      */
/* Purpose:     Include file for ANSI Standard C assertion handler            */
/*                                                                            */
/*============================================================================*/
#include "cvidef.h"
#include "cvirte.h"
#ifndef _ASSERT_H_
#define _ASSERT_H_
#ifdef __cplusplus
 extern "C" {
#endif
#undef assert
#ifdef NDEBUG
#define assert(exp) ((void)  0)
#else
void CVIANSI _assert(char *, char *, int); // <-----------------------------------
#define assert(exp) ((exp) ? (void) 0 : _assert(#exp, __FILE__, __LINE__))
#endif
#ifdef __cplusplus
 }
#endif
#endif /* _ASSERT_H_ */
--
To whom it may concern: My alias is also my nickname, I've had it since I was a (very) skinny basketball-playing teen. OK, so I've got a 38 inch waist now, but my hometown friends haven't shaken that appellation for me. I trust that you will someday be OK with that alias, as I have been with that nickname.
0 Kudos
Message 1 of 3
(3,420 Views)
JB:
Usually when I see a problem like this, the culprit tends to be something in the code which is including assert.h, immediately above that #include. In this case, it could also be an #include for ansi_c.h, because the first thing it includes is assert.h.
 
Basically, the first substantive code in assert.h (assuming that cvidef.h and cvirte.h have been included elsewhere before, which is probably a good bet) is on the line you indicated. The compiler is saying that it saw 'void' (the first token on that line) when it expected a ';'. This usually means the expression before the #include for this file was not properly terminated (possibly a structure or variable declaration, possibly residing in another header file).
 
I was not able to reproduce the behavior you are seeing directly, so if this does not help, please post a small project which reproduces the problem and I'll have a look at it.
 
Thanks,
 
-alex
Message 2 of 3
(3,413 Views)
Wow, nice advice Alex!  I had something else to finish yesterday, so I didn't even look at fixing this project until this morning.  It seems I made slip-up when I updated a variable (one that keeps track of the major CVI version the project was built with), and left off the semi-colon that terminated the statement!  I use this varaible to make sure that new CVI executables don't run in a much older run-time engine.
 
So basically, what the 7.x version of the project had was:
 
int CVI_VER = 700;
#include <ansi_c.h>
 
...and when I edited it (which was pretty much the ONLY edit I made, go figure), I accidentally did this:
 
int CVI_VER = 800       (note the missing semi-colon)
#include <ansi_c.h>
 
I guess I got lazy and expected the compiler to point at the actual chunk of code that was at fault, rather than something else further down that was affected by that missing semi-colon.  Live and learn.
 
Thanks again, Bye for now,
 
JB
 
--
To whom it may concern: My alias is also my nickname, I've had it since I was a (very) skinny basketball-playing teen. OK, so I've got a 38 inch waist now, but my hometown friends haven't shaken that appellation for me. I trust that you will someday be OK with that alias, as I have been with that nickname.
0 Kudos
Message 3 of 3
(3,394 Views)