Two codes with identical errors, only one compiles

Hey, big noob here so I apologize in advance if it sounds silly.

For context, I’m working with the Paxcounter code, and I’m currently modifying the code to adapt it to a specific use case. I’m using PlatformIO IDE on Vscode and Arduino framework.
I first uploaded the original Paxcounter code to my TTGO T-Beam v1.1 dev card and it worked completely fine. Then, I modified the code and now it does not compile anymore. When checking for errors, something strange happens…
When using the pio check --skip-packages command on both the original Paxcounter code and the one I modified, they both have the same errors! However only the original Paxcounter code builds successfully… How is that possible ? I can clearly see the errors in the Build console from the modified code, but my question is why are they not displayed when using the check command?

Note: the line numbers might not correspond for the payload.h file, but that is because I added some content in it. The lines are referring exactly to the same content.

Output for original Paxcounter code :

include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
src\hash.cpp:43: [low:style] The function 'myhash' is never used. [unusedFunction]
src\i2c.cpp:48: [low:style] The scope of the variable 'i' can be reduced. [variableScope]      
src\i2c.cpp:49: [low:style] The scope of the variable 'iDevice' can be reduced. [variableScope]
src\i2c.cpp:49: [low:style] The scope of the variable 'iCount' can be reduced. [variableScope] 
src\i2c.cpp:51: [low:style] The scope of the variable 'szName' can be reduced. [variableScope] 
src\i2c.cpp:13: [low:style] The function 'i2c_deinit' is never used. [unusedFunction]
src\i2c.cpp:8: [low:style] The function 'i2c_init' is never used. [unusedFunction]
src\i2c.cpp:77: [low:style] The function 'i2c_readBytes' is never used. [unusedFunction]       
src\i2c.cpp:15: [low:style] The function 'i2c_scan' is never used. [unusedFunction]
src\i2c.cpp:98: [low:style] The function 'i2c_writeBytes' is never used. [unusedFunction]      
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
src\led.cpp:27: [low:style] The function 'rgb_led_init' is never used. [unusedFunction] 
src\led.cpp:19: [low:style] The function 'rgb_set_color' is never used. [unusedFunction]
src\led.cpp:34: [low:style] The function 'switch_LED' is never used. [unusedFunction]   
src\led.cpp:54: [low:style] The function 'switch_LED1' is never used. [unusedFunction]  
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:98: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
================================================================================================================ [PASSED] Took 29.27 seconds ================================================================================================================

Component     HIGH    MEDIUM    LOW
-----------  ------  --------  -----
include        13       0        0
src            0        0       14

Total          13       0       14

Environment    Tool      Status    Duration
-------------  --------  --------  ------------
usb            cppcheck  PASSED    00:00:29.267

Output for the modified Paxcounter code :

include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
src\hash.cpp:43: [low:style] The function 'myhash' is never used. [unusedFunction]
src\i2c.cpp:48: [low:style] The scope of the variable 'i' can be reduced. [variableScope]      
src\i2c.cpp:49: [low:style] The scope of the variable 'iDevice' can be reduced. [variableScope]
src\i2c.cpp:49: [low:style] The scope of the variable 'iCount' can be reduced. [variableScope] 
src\i2c.cpp:51: [low:style] The scope of the variable 'szName' can be reduced. [variableScope] 
src\i2c.cpp:13: [low:style] The function 'i2c_deinit' is never used. [unusedFunction]
src\i2c.cpp:8: [low:style] The function 'i2c_init' is never used. [unusedFunction]
src\i2c.cpp:77: [low:style] The function 'i2c_readBytes' is never used. [unusedFunction]       
src\i2c.cpp:15: [low:style] The function 'i2c_scan' is never used. [unusedFunction]
src\i2c.cpp:98: [low:style] The function 'i2c_writeBytes' is never used. [unusedFunction]      
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
src\led.cpp:27: [low:style] The function 'rgb_led_init' is never used. [unusedFunction] 
src\led.cpp:19: [low:style] The function 'rgb_set_color' is never used. [unusedFunction]
src\led.cpp:34: [low:style] The function 'switch_LED' is never used. [unusedFunction]   
src\led.cpp:54: [low:style] The function 'switch_LED1' is never used. [unusedFunction]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
include\payload.h:109: [high:error] #error No valid payload converter defined! [preprocessorErrorDirective]
=========================================================================== [PASSED] Took 36.11 seconds ===========================================================================
Component     HIGH    MEDIUM    LOW
-----------  ------  --------  -----
include        13       0        0
src            0        0       14

Total          13       0       14

Environment    Tool      Status    Duration
-------------  --------  --------  ------------
usb            cppcheck  PASSED    00:00:36.107

pio check does a static code analysis. It doesn’t actually try to compile the files.

If you want to check whether compilation succeeds you need to do pio run.

Okay, so this check command is not the most appropriate in this specific case, thanks.