03-23-2021 10:11 PM
Hello,
I am trying to build a custom DLL that uses a third party set of header files. Those header files seem to call various other standard header files. I keep getting compilation errors because the compiler can't find some of those header files that I would think are pretty standard (such as io.h). I managed to find some of them in the "program files" folder for my Visual Studio installation, but then there will be some new header missing when I try the build again. Trying to understand what is wrong with my setup because I believe the standard NI CVI installation should have most of what I need. I have the Windows 10 SDK installed. Anyone experienced issues like this before?
Here is my setup:
Windows 10 64 bit
CVI 2017
Solved! Go to Solution.
03-24-2021 04:39 AM
CVI cannot interface with Win10 SDK even if installed on the system: it still works with SDK 8.1.
This update has been requested several times (e.g. this discussion, where vix was facing the same situation as yours) but at present there is no info as to if and when this update will be implemented. You can support this idea posted by Wolfgang in the Idea Exchange and hopefully it will addressed at some time in the future (although it has just celebrated its third birthday 🙄 and it's still marked as New 😫 Hello NI, can you hear us and comment???)
03-24-2021 08:49 AM
Thanks for the info. I'm fine with using SDK 8.1 if it allows me to build my project. It also looks like using VC runtime, which I have installed, will work for many of these header files.
How do I generally configure my project to point to certain libraries for this sort of thing. I went to Options > Environment > Include Paths to make it point to certain libraries, but not sure if this is the correct method. I just want to make sure that my environment points to all the files I may need generally for builds.
03-24-2021 09:48 AM
Roberto, I am getting the below compilation errors, any ideas about these? See highlighted errors. Note, I am pointing to Win SDK 8.1 and Visual Studio VC libraries. You can disregard the last error, it's due to a missing custom header file from a third-party library.
Build Status (1553_Acyclic_Messaging.prj - Debug)
1553_Acyclic_Messaging.c - 4 errors, 1 warning
12, 1 In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\1553_Acyclic_Messaging.c:12:
"AiOs.h"(56,1) In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\Include\AiOs.h:56:
"AiOsWindows.h"(25,1) In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\Include\AiOsWindows.h:25:
"Windows.h"(213,1) In file included from C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\windows.h:213:
"windef.h"(24,1) In file included from C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\windef.h:24:
"minwindef.h"(182,1) In file included from C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\minwindef.h:182:
"winnt.h"(396,9) error: unknown type name 'sdk_wchar_t'
"Ai_cdef.h"(160,1) note: WARNING: AI_DEPRECATED is not implemented for this compiler
12, 1 In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\1553_Acyclic_Messaging.c:12:
"AiOs.h"(56,1) In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\Include\AiOs.h:56:
"AiOsWindows.h"(37,1) In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\Include\AiOsWindows.h:37:
"ansi_c.h"(36,1) In file included from c:\engtools\ni2017\labwindows 2017\include\ansi_c.h:36:
"stdlibex.h"(43,3) error: typedef redefinition with different types ('struct lldiv_t' vs 'struct _lldiv_t')
"stdlib.h"(291,3) note: previous definition is here
12, 1 In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\1553_Acyclic_Messaging.c:12:
"AiOs.h"(56,1) In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\Include\AiOs.h:56:
"AiOsWindows.h"(108,1) error: implicit declaration of function 'stricmp' is invalid in C99. Make sure that you include the function prototype.
"AiOsWindows.h"(39,1) note: expanded from macro 'STRICMP'
13, 1 In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\1553_Acyclic_Messaging.c:13:
"Api1553.h"(29,1) In file included from c:\Repositories\lru3-atp\TPS\TPSW Utilities\1553 Acyclic Messaging\Include\Api1553.h:29:
"Api1553Cvi.h"(29,1) fatal error: 'Ai1553_Internal_def.h' file not found
Build failed.
03-26-2021 06:24 AM - edited 03-26-2021 06:26 AM
stricmp is not part of the C standard. The C standard has no case insensitive string comparison functions at all. Posix and Windows SDK and other standards and libraries do have that but under non conformant names. With C99, use of functions without an explicit declaration first is not allowed. Before C99 it was and you would then get linker errors if the C runtime used by the compiler did not provide that function. Otherwise it would silently compile and link with the library and the function prototype inferred from the calling site, which could or could not match the actual function in the C runtime and hence cause stack and memory corruptions and/or crashes.
GCC likes to use names without prepended underscore anyways, despite being not part of the C standard. Microsoft C properly defines them with an underscore in front to indicate that they are not part of the C standard but in fact compiler extensions.
Welcome in the land of C header madness! 😁 Especially if you try to target multiple platforms.