Dear community
Presenting my case will be extremely challenging because it involves a HUGE project I have been working on for the past 3 years or so, involving dozens of files and nearly 10,000 lines of code. I will try my best since due to IP issues I cannot disclose much information about its real contents.
My project, based on a big custom wrapper library that merges and “packs” several peripherals and functionalities, had been working FLAWLESSLY until the past 2 days when it decided to completely break compilation and the project is unusable. After compiling everything turns red. I am in a panic state right now. I am unsure if a recent update in the pio core broke something.
The problem is the following:
My custom wrapper Class library (_WrapperLib") that lives inside the lib folder contains a header file called definitions.h
. I use an external library that contains a header file with exactly the same name: definitions.h
.
The external libraries are declared in the platformio.ini file using:
lib_extra_dirs = $PROJECT_DIR/../../libs
each and every one of my custom libraries including the wrapper library and a bunch of custom classes is also declared in the .ini file as:
build_flags =
-I lib/WrapperLib
-I lib/Class1
-I lib/Class2
...
-I lib/ClassN
(my project heavily uses inheritance to control a ton of peripherals attached to the board under development)
When opening the file definitions.h
from the wrapper class everything inside the preprocessor directives is greyed out:
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
// All definitions are greyed out and thus this file is getting ignored!
#endif
Please note the different shades. Also, I am using the #pragma once
directive in all files!
when right-clicking the definitions.h
text in the VSCode header that calls this header file and I select the “Go to Definition…” option it opens the header file from the EXTERNAL LIBRARY! Not the one from my own Wrapper Class.
Why is this happening? It used to be fine and this suddenly happened.
I have uninstalled VScode + pio wiping everything out. Running the compilation with NO additional extensions and nothing. Compilation fails EVERY TIME. I have tried on 3 different PCs and I am facing the same problem.
Any ideas would be very much appreciated.