Compile a C++ file

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

cross mob
user_2112781
Level 4
Level 4
10 likes received 10 likes given 5 likes given

Is there a way to compile a C++ file in the Wiced SDK ? I tried a simple application test that includes and I get a lot of errors.

I tried on macOS and Linux and the errors are the same. Any idea ?

Thank you

./tools/ARM_GNU/bin/Linux64/../../include/bits/memoryfwd.h:63:3: error: template with C linkage

   template<typename>

   ^

./tools/ARM_GNU/bin/Linux64/../../include/bits/memoryfwd.h:66:3: error: template specialization with C linkage

   template<>

   ^

./tools/ARM_GNU/bin/Linux64/../../include/bits/memoryfwd.h:70:3: error: template with C linkage

   template<typename, typename>

   ^

In file included from ./tools/ARM_GNU/bin/Linux64/../../include/string:39:0,

                 from apps/snip/foo/foo.cpp:1:

./tools/ARM_GNU/bin/Linux64/../../include/bits/stringfwd.h:52:3: error: template with C linkage

   template<class _CharT>

   ^

./tools/ARM_GNU/bin/Linux64/../../include/bits/stringfwd.h:55:3: error: template with C linkage

   template<typename _CharT, typename _Traits = char_traits<_CharT>,

   ^

./tools/ARM_GNU/bin/Linux64/../../include/bits/stringfwd.h:59:3: error: template specialization with C linkage

   template<> struct char_traits<char>;

   ^

./tools/ARM_GNU/bin/Linux64/../../include/bits/stringfwd.h:65:3: error: template specialization with C linkage

   template<> struct char_traits<wchar_t>;

   ^

In file included from ./tools/ARM_GNU/bin/Linux64/../../include/bits/stl_algobase.h:61:0,

                 from ./tools/ARM_GNU/bin/Linux64/../../include/bits/char_traits.h:39,

                 from ./tools/ARM_GNU/bin/Linux64/../../include/string:40,

                 from apps/snip/foo/foo.cpp:1:

./tools/ARM_GNU/bin/Linux64/../../include/bits/cpp_type_traits.h:72:3: error: template with C linkage

   template<typename _Iterator, typename _Container>

   ^

0 Likes
1 Solution
Anonymous
Not applicable

Try  in  sdk3.7.0 (looks same in 4.0) file  WICED-SDK\tools\makefiles\wiced_toolchain_ARM_GNU.mk

make small change  add COMPILER_SPECIFIC_SYSTEM_DIR_CXX and change CXX

ifeq ($(COMPILER_SPECIFIC_SYSTEM_DIR),)

COMPILER_SPECIFIC_SYSTEM_DIR := -isystem $(TOOLCHAIN_PATH)../../include -isystem $(TOOLCHAIN_PATH)../../lib/include -isystem $(TOOLCHAIN_PATH)../../lib/include-fixed

COMPILER_SPECIFIC_SYSTEM_DIR_CXX := $(TOOLCHAIN_PATH)../../include $(TOOLCHAIN_PATH)../../lib/include $(TOOLCHAIN_PATH)../../lib/include-fixed

endif

CC       = "$(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)gcc$(EXECUTABLE_SUFFIX)" $(COMPILER_SPECIFIC_SYSTEM_DIR)

CXX      = "$(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)g++$(EXECUTABLE_SUFFIX)" $(COMPILER_SPECIFIC_SYSTEM_DIR_CXX)

This change help compile C++ files for us.

Can wiced team approve this fix?

View solution in original post

5 Replies
Anonymous
Not applicable

Which sdk version you used?

With 3.5.2 no problems. With 3.7.0 was problem in makefile. Need do some correction.

0 Likes

Hi darius1

I am using the SDK 4.0.0 and my CPU is a Cortex R4.

Thank you    

0 Likes
Anonymous
Not applicable

I not interesting in wiced4, because removed support for freertos-lwip. But think, that same makefile bug, like 3.7.0 ...   I am not at workplace, so what need change, i will append later.

Anonymous
Not applicable

Try  in  sdk3.7.0 (looks same in 4.0) file  WICED-SDK\tools\makefiles\wiced_toolchain_ARM_GNU.mk

make small change  add COMPILER_SPECIFIC_SYSTEM_DIR_CXX and change CXX

ifeq ($(COMPILER_SPECIFIC_SYSTEM_DIR),)

COMPILER_SPECIFIC_SYSTEM_DIR := -isystem $(TOOLCHAIN_PATH)../../include -isystem $(TOOLCHAIN_PATH)../../lib/include -isystem $(TOOLCHAIN_PATH)../../lib/include-fixed

COMPILER_SPECIFIC_SYSTEM_DIR_CXX := $(TOOLCHAIN_PATH)../../include $(TOOLCHAIN_PATH)../../lib/include $(TOOLCHAIN_PATH)../../lib/include-fixed

endif

CC       = "$(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)gcc$(EXECUTABLE_SUFFIX)" $(COMPILER_SPECIFIC_SYSTEM_DIR)

CXX      = "$(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)g++$(EXECUTABLE_SUFFIX)" $(COMPILER_SPECIFIC_SYSTEM_DIR_CXX)

This change help compile C++ files for us.

Can wiced team approve this fix?

Thank you so much darius1​, that does it !