LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Unnecessary Includes in Compile/Linker

So we've got this issue that is baffling us. 

 

Running Full Development System CVI 2017 v. 17.0.0

 

We have a 'common' folder that is shared across other projects. Inside the folder is .c, .h files for individual modules. All of our projects have a copy of this folder, and we only use the modules we need from it.

 

To facilitate this overlap, the loader inside the common code has a set of __has_include() compiler directives to guard against compiling code that's not supposed to be included in the top level project. __has_include() works by checking if the header file passed is available to the compiler.

 

Some of our team members can compile these projects without any issues, while others, like myself, get linker errors at the end of the build because of this common folder.

 

We've isolated the cause of the failure, but we can't figure out how to FIX it.

On systems that fail to build/link, we have noticed that the CC_options.txt file contains the flag "-I <path_to_common_folder>" which is forcing the compiler to have knowledge of ALL the common headers, not just the ones we included. This causes it to pass the precompiler __has_include() directive, include the code, and then fail at link time.

 

On the systems that successful build, the -I flag for the common folder is not included in the CC_options.txt file.

 

What's absolutely baffled us is that we all share the same .prj file. We can't find a flag in the .cws file or anywhere on the system that controls the inclusion/exclusion of the folder, so we can't stop it from being sent to the compiler. 

 

Does anyone have any idea how to control this? 

0 Kudos
Message 1 of 4
(1,891 Views)

It may be that some of the include directories are saved in registry. Can you verify, on the faulty machines, if that folder is listed in REG: Computer\HKEY_CURRENT_USER\SOFTWARE\National Instruments\CVI\17.0\IncludePaths?

0 Kudos
Message 2 of 4
(1,889 Views)

Just checked, that particular registry folder is empty on my machine, so that doesn't seem to be the culprit.

0 Kudos
Message 3 of 4
(1,887 Views)

We just figured it out.

 

When the project contains a Function Panel (.fp) file, it automatically includes the folder path of that function panel in the include list. We happened to have one of those function panels in our project. Once it was removed and the function panel was unloaded, the folder stopped being included.

 

It doesn't answer why others didn't see it, but that could be related to versioning and the specific file failing.

0 Kudos
Message 4 of 4
(1,873 Views)