LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

can't find ansi_c.h library

Solved!
Go to solution

Though my problem is eerily similar to this thread, my CVI install already knows where the include folder is located.

 

I am trying to use the ANSI_C open/close/read/write IO functions.  Here's a sample project...

 

#include <cvirte.h>		
#include <ansi_c.h>
#include "ANSI_C copy.h"

static int panelHandle;
int led_error = 0;
int button_toggler = 1;


char sourcePath[1000];
char targetPath[1000];

int sourceHandle, targetHandle;


int main (int argc, char *argv[])
{
	if (InitCVIRTE (0, argv, 0) == 0)
		return -1;	/* out of memory */

	
	//--------------------
	
	
	sourceHandle = open(sourcePath,O_RDONLY);
	
	
	
	//--------------------
	return 0;
}

 Now, when I click compile, CVI reports this...

2014-10-21 11_44_42-LabWindows_CVI Message.png

 

even though, clearly, "ansi_c.h" already is included at the top.  If I click Yes, it just adds the exact same line above the first.

 

What's more, if I right click over that line and choose Open Quoted Text, the correct ansi_c.h file opens from the correct include install folder.

 

What is going on here?

0 Kudos
Message 1 of 3
(8,123 Views)

Well, I think I answered my own question, or at least found the correct library to include.  I did a search for the function name "open" in the entire includes folder:

 

"c:\Program Files\National Instruments\CVI2013\include\"

 

Found it in  "lowlvlio.h"!

 

So the CVI IDE is apparently asking for the wrong library.  The above code compiles now.

0 Kudos
Message 2 of 3
(8,114 Views)
Solution
Accepted by topic author ElectroLund

Hello Electrolund,

 

CVI offers to #include files based on the library the functions that don't have a declaration are in.

In the case of open(), the library is ANSI C Library but the file to include is not ansi_c.h

In the help for open there is a note that says:

"Note This function is not in the ANSI standard. You must include lowlvlio.h in your program or interactive window to use this function."

However, the information under Additional Information is errorneous:

"Include file: ansi_c.h"

Just ignore it and follow the Note 🙂

 

Constantin.

Message 3 of 3
(8,098 Views)