LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why doesn't time_t work in 7.1

Hello,

 

I developed a GUI in LabWindows 9.0 which used the time_t type and other time functions etc. Everything worked fine on my office computer but I needed to import this GUI to another computer that is running LabWINDOWS 7.1.

 

When I try to run the GUI in 7.1, I get the error "illegal use of type 'time_t'". I've erased the declaration and re-typed it, etc. ensured time.h was included etc. but no go. I'm out of ideas?

 

I also seem to run into a similar issue with FILE. Again, everything worked perfectly on my PC w/9.0 but not on the 7.1 machine.

 

I tried starting a new file in 7.1 using time_t but still got the issue. Is this not supported in 7.1? If so, how do I go about getting time readings for timestamps?

 

 

 

Thanks!

JT

0 Kudos
Message 1 of 6
(3,626 Views)

Hi,

 

newer GUI versions may provide new functionality and hence it is not guaranteed that a GUI will load or work in an earlier version of CVI. You can try and save the GUI in CVI 9.0 using the 'Save As' dialog, which provides the option to save in earlier versions, including 7.1

 

 

uir.jpg.

0 Kudos
Message 2 of 6
(3,620 Views)
If neither time_t nor FILE work correctly, then you most likely have some
#include confusion.
Could be another included header with different definitions
Could be the headers are from a wrong directory (for another compiler for
instance)
Look at what other kind of headers you include and in what order. And header
files may include other header files as well. windows.h is often a culprit
here.

I mean they are very basic C definitions, so they _must_ work.
--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 3 of 6
(3,612 Views)

Thanks for the replies!

 

I did go back and "Save as" 7.1 after I opened the 9.0 file in 7.1 and got several error messages. I don't remember the exact error message but it was along the lines of something being created in a later version and can't be used here. Would I like to continue anyway....

 

After wiping out the original install of my program (not LabWINDOWS), I installed the new "saved as 7.1" version. The program loaded without incident but at run time, I got the errors about the illegal use of time_t.

 

Here is the list of header files that are in my .c file:

 

#include <ansi_c.h>
#include <cvirte.h>  
#include <userint.h>
#include "User Interface Application.h"
#include <stdio.h>
#include <time.h>

 

 

 

I thought the .uir (or some other file) may have been corrupted while loading my program on to the PC so I made a simple test CVI file consisting of just the time functions. Same "illegal use" issue came up.

 

I'm wondering if recbuilding the program from scratch might reset some stuff??? That would be tedious but perhaps necessary.

 

I'm also wondering if the install of CVI 7.1 and/or some libraries didn't get installed correctly? If this is the case, then obviously rebuilding the program wouldn't help.

 

Thanks again for the comments. I appreciate any and all help!!

0 Kudos
Message 4 of 6
(3,599 Views)

Figured it out!

 

In my original v9.0 code, I was declaring the 'time' and FILE variables inside a case statement of a switch.

 

I moved the declarations outside the case statement and now everything works fine!

 

I'm a newbie to CVI (I usually work in LabVIEW) so I guess this is a newbie mistake!

 

Thank you for all the suggestions!

 

JT

0 Kudos
Message 5 of 6
(3,584 Views)
> Here is the list of header files that are in my .c file:
As a general rule, the order should be:
- 1st the C standard libraries: stdio.h, stdlib.h, string.h, math.h...
Possibly all together in ansi_c.h
- then, if required, the Windows specific stuff: windows.h
- then the CVI specifics: cvirte.h, userint.h, toolbox.h...
- then the exports from other modules in your own code (if you have more
than one .c in your project), including the .h corresponding to the .uir
files.
- then the exports for the present .c, just to catch mismatches between
declarations and definitions at compile time instead of link time.

--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 6 of 6
(3,575 Views)