LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

File compile hierarchy problem: Windows SDK, winbase.h, HeapAlloc

Hi all,
 
I am using CVI 8.0.0 under Windows XP.
 
I am trying to include an .h file in my main program. The .h file has this following line:
HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, size);
Therefore, I am including windows.h. It is working well but when I add this .h file to my project, this file is  compiled before winbase.h and therefore, I become a "Missing Prototype" error at that line and then a "Redeclaration of HeapAlloc" in winbase.h. It seems that the compile hierarchy changes somehow.
 
Do you have any suggestions?
 
Thanks
0 Kudos
Message 1 of 3
(3,291 Views)

This kind of problem is often caused by the positioning of the #include <windows.h> statement in the source code. It should be the first line, before all other #includes. This might help your situation.

JR

0 Kudos
Message 2 of 3
(3,284 Views)
Both .c file and .h file have #include <windows.h> at the first line.
Interestingly, when I add only the .c file to the project, I get no compiler error and it works well. However, I get this "Missing Prototype" and "Redeclaration" errors, only when the project tree has the .h file.

What causes this change of behavior?
And is it possible to add the .h files to the project, without changing the compile process? (like .c files can be excluded from build)

Thanks
0 Kudos
Message 3 of 3
(3,278 Views)