Cannot remove a function after build

If you are asking a question, please follow this template:

  1. My goal is: Remove a function after build
  2. My actions are: mos build and mos build all
  3. The result I see is: [screenshot.png ]
  4. My expectation & question is:
    I have a local library with a directory structure as:
    app2\deps\LPM013\src\mgos_lpm013.c mgos_lpm013.h

In mgos_lpm013.h, once I had a test function namely mgos_LPM013_init(void) as the prototype and mgos_LPM013_init(void) implemented in mgos_lpm013.c. That function called successfully from main.c without problem.

After testing I just removed that function from .h and .c, and removed its call from main.c altogether. For some unknown reasons, a second build by mos build showed an error with undefined reference to mgos_LPM013_init which I have removed it all from the library and main.c.

There is no mos clean function, so I have tried mos build all but the error is still there. Why is it so? Any method to clean the .a files like other IDEs?

John

Each library must have a init function which is called automatically by the initialization sequence of the application.

To build clean, use mos build --clean.

1 Like