#include "wiced.h" in cpp file

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BaT_3785171
Level 2
Level 2
First like given

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.

pastedImage_0.png

Why this error ?

As per my understanding compilation should happen successfully.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
ToLa_2193696
Level 3
Level 3
First like received First like given

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

pastedImage_0.png

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

View solution in original post

3 Replies
lock attach
Attachments are accessible only for community members.
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

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.

lock attach
Attachments are accessible only for community members.
ToLa_2193696
Level 3
Level 3
First like received First like given

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

pastedImage_0.png

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

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.