LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows 8 Error in analysis.h

I just updated from CVI version 7 to 8 and am now getting two errors not previously seen:
 
"analysis.h"(254.5) Expecting an enumerator identifier.
"analysis.h"(254.5) syntax error; found'-' expecting'}'.
 
This section of analysis.h:
 
/* Marix balance */
typedef enum {
   NONE       = 0,        // Neither purmuted nor Scaled   <-- this is line 254
     .
     .
     .
}  AnalysisLibMatrixBalance.
 
I haven't changed any code, so this appears to be related to the update. Any ideas?
0 Kudos
Message 1 of 8
(4,667 Views)
My guess would be that one of your headers included before analysis.h has already #defined NONE to something that has a '-' in it.  If you are not using that definition of NONE, you can probably just undefine it before you include analysis.h:

// Various includes
...
#undef NONE
#include "analysis.h"

Mert A.
National Instruments
0 Kudos
Message 2 of 8
(4,660 Views)
Mert,
 
Your suggestion works, thanks. However, is this not risky if one of the previous files really needs NONE? (I do not use NONE in anything I wrote.)
 
Regards,
 
Steve
0 Kudos
Message 3 of 8
(4,653 Views)
Hi Steve,

This is only risky if a header or source code after analysis.h uses NONE in the original #defined sense.  The #undef directive only affects code (including #included header files) that comes after it, so as long as the code in your c file and none of the headers following analysis.h use NONE for it's original meaning, you should be fine.  If one of the headers does happen to use NONE in that sense (which is probably not the case), you can try moving the #include of that header above analysis.h.

Mert A.
National Instruments
0 Kudos
Message 4 of 8
(4,654 Views)

Mert,

Thanks for the explanation.

Steve

0 Kudos
Message 5 of 8
(4,643 Views)
Hi,
Same error in LabWindows 8.5. 
 
Noted that in LabWindows 8.0 that the C:\Program Files\National Instruments\CVI80\toolslib\activex\word\wordreport.h added the following at line 13:
#define NONE                -1
 
The enumeration for AnalysisLibMatrixBalance in analysis.h did not change.
typedef enum {
    NONE            = 0,    // Neither Permuted nor Scaled
    PERMUTED        = 1,    // Permuted
    SCALED          = 2,    // Scaled
    PERMUTED_SCALED = 3     // Permuted and Scaled
} AnalysisLibMatrixBalance;
 
0 Kudos
Message 6 of 8
(4,334 Views)

Hi,

Here's simple program showing error (LabWindows v8.5):

#include "wordreport.h"
#include <analysis.h>
#include <cvirte.h>

int main (int argc, char *argv[])
{
   CAObjHandle data_report = 0;
   CAObjHandle ms_word = 0;
  
   if (InitCVIRTE (0, argv, 0) == 0)
      return -1;    /* out of memory */
  
   GetAnalysisErrorString (20006);
   WordRpt_DocumentNew (ms_word, &data_report);
   return 0;
}

Two errors on compile:

"analysis.h"(300,5)  Expecting an enumerator identifier.
"analysis.h"(300,5)  syntax error; found '-' expecting '}'.

 

TAJ

0 Kudos
Message 7 of 8
(4,312 Views)

Hello TAJ,

Yes, you're correct. This is definitely a bug. I guess you might be the first person to combine wordreport and the analysis library in the same source file 🙂

This will be fixed in an upcoming CVI relesase. In the meanwhile, and assuming that you're not actually using NONE in your source code, you can insert an #undef NONE line between the two include statements.

Sorry about that.

Luis

0 Kudos
Message 8 of 8
(4,301 Views)