1 Reply Latest reply on Sep 25, 2018 11:48 PM by tikrc_3055496

    Adding C++ files and compiling it in wiced 6.1

    sugac_3385211

      I want to add some c++ files in wiced 6.1. Just to check that for c++ compilation,I renamed (apps/snip/)scan.c to scan.cpp and modified scan.mk ,and I found that it fails to compile.

      Please let me know the correct way to add and compile c++ files in WICED 6.1.

       

       

      What I tried is below :

      1. Renamed (apps/snip/)scan.c to (apps/snip/)scan.cpp

      2. Updated Makefile as following :

      *****************************************************************************************************************************

      scan.mk

       

      NAME := App_Scan

      $(NAME)_SOURCES := scan.cpp

      *****************************************************************************************************************************

      3.Make Command : snip.scan-XYZ-FreeRTOS-LwIP-SDIO

      Build Error

      *****************************************************************************************************************************

      make.exe[1]: *** No rule to make target 'apps/snip/scan/scan.c', needed by 'build/snip.scan-XYZ-FreeRTOS-LwIP-SDIO/Modules/apps/snip/scan/scan.o'.  Stop.

      make.exe[1]: *** Waiting for unfinished jobs....

      Building Bootloader

      Finished Building Bootloader

       

      make: *** [main_app] Error 2

      Makefile:349: recipe for target 'main_app' failed

      *****************************************************************************************************************************

       

      Note : It compiles properly without above changes.i.e if compiled as c file.

        • 1. Re: Adding C++ files and compiling it in wiced 6.1

          Short:

          Clean the project and then rebuild it.

           

          A little bit longer:

          If you create a project with a .c file and you build it, its object file is created depending on the .c file. If you rename the .c file to .cpp the dependency between the source and object file breaks and your error gets raised.

           

          This seems to be a makefile problem since there shouldn't be a persisting dependency between source and object file after the build process.