3 Replies Latest reply on Nov 22, 2018 8:58 PM by rroy

    #include "wiced.h" in cpp file

    babajan.T_3785171

      I added MyCode.cpp to this path 43xxx_Wi-Fi\apps\snip\scan.

       

      Contents of MyCode.cpp is as follows.

      /************start of MyCode.cpp************/

      #include "wiced.h"

      /************End of MyCode.cpp************/

       

      Contents of scan.mk is as follows.

      NAME := App_Scan

      $(NAME)_SOURCES := scan.c

      $(NAME)_SOURCES += MyCode.cpp

       

      While compiling following error is coming.

       

      Why this error ?

      As per my understanding compilation should happen successfully.

        • 1. Re: #include "wiced.h" in cpp file
          rroy

          I don't receive this error when trying to reproduce the exact same scenario. Looks like there is a '}' missing in wiced.h from the error log in your case. Please replace the wiced.h with the attached one and the error should go away.

          1 of 1 people found this helpful
          • 2. Re: #include "wiced.h" in cpp file
            tlangmo

            Hi,

            I successfully use wiced in a c++11 project. However, out of the box I ran into compilation issues as well.

            One header file has an unbalanced extern "C" block. Try to fix that first and compile again.

             

            WICED/security/BESL/host/WICED/tls_types.h

            I also had to make some changes to the file

            tools/makefiles/wiced_toolchain_ARM_GNU.mk

             

            among others added a -std=c++11 -Wno-literal-suffix

             

            COMPILER_SPECIFIC_STANDARD_CXXFLAGS = -Wall -fsigned-char -ffunction-sections -fdata-sections -fno-common -fno-rtti -fno-exceptions -fdiagnostics-color -std=c++11 -Wno-literal-suffix  $(if $(filter yes,$(CYPRESS_INTERNAL) $(TESTER)),-Werror)

             

            Please see the attached files

            2 of 2 people found this helpful
            • 3. Re: #include "wiced.h" in cpp file
              rroy

              Thanks a lot for your valued suggestions. One more thing I wanted to add which might look obvious: If you are trying to run

              int run_test(int argc, char **argv) for a .cpp file, replace the same thing with extern "C" int run_test(int argc, char **argv) for successfully compiling a .cpp code.

              1 of 1 people found this helpful