Skip to main content
Associate III
September 26, 2024
Solved

Compilation error on a file not included in the project

  • September 26, 2024
  • 1 reply
  • 865 views

In my project I use some git submodules to add features.

One of this submodules has a complex folder structure to add documentation, tests, examples and so on. But I only need the src folder.

Given how Git submodules work, the entire folder structure is downloaded, so I had to remove the unwanted folders from the compilation.

Now I can use the submodule and compile my project, but in the test folder of the submodule there is a main.c file that I don't include in my compilation. I tried to write a malformed line of code to see if it would report an error or not and I am sure that that file is not compiled, since I don't get the error.

But I still get an error after the compilation:

 

The float formatting support is not enabled, check your MCU Settings from "Project Properties > C/C++ Build > Settings > Tool Settings", or add manually "-u _printf_float" in linker flags.

 

The error points to the following line in the main.c:

 

 

printf("Coverage : %f\r\n", (float)(tests_passed) / (float)(tests_passed + tests_failed));

 

 

As I said, I'm sure that the file is not compiled, because if it were it would generate a syntax error.

How come it emit an error about the project configuration?

I tried following the error message and enabled the printf checkbox and the error actually goes away, but that's not the way I want to fix this.

Best answer by Douglas MILLER

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.

1 reply

Douglas MILLER
Douglas MILLERBest answer
ST Employee
September 27, 2024

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.