Skip to content

templates must have C++ linkage #43

Description

@rainbowkenny

Hi,
I followed your steps to build the blinky example. I'm using a Mac.
No matter what I try, I'm always seeing the following error: "/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:101:1: error: templates must have C++ linkage"
=============Full error message below==============

C02ZK0Q0LVDN:mbed-simulator shuhan01$ node cli.js -i demos/blinky -o out --launch
libmbed.bc does not exist. Building...
'mbed deploy' did not run before, running...
Failed to build libmbed (1)
cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/Users/shuhan01/.emscripten_cache/is_vanilla.txt" for subsequent builds)
cache:INFO: - ok
shared:WARNING: Assuming object file output in the absence of -c, based on output filename. Please add with -c or -r to avoid this warning
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/LoRaWANStack.cpp:911:18: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
_lw_session.uplink_counter, _lw_session.downlink_counter);
^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/LoRaWANStack.cpp:911:46: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
_lw_session.uplink_counter, _lw_session.downlink_counter);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
2 warnings generated.
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/lorastack/mac/LoRaMac.cpp:910:43: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
tr_debug("RX1 slot open, Freq = %lu", _params.rx_window1_config.frequency);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%u
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/lorastack/mac/LoRaMac.cpp:939:43: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
tr_debug("RX2 slot open, Freq = %lu", _params.rx_window2_config.frequency);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%u
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/lorastack/mac/LoRaMac.cpp:1132:65: warning: format specifies type 'unsigned long' but the argument has type 'lorawan_time_t' (aka 'unsigned int') [-Wformat]
tr_debug("DC enforced: Transmitting in %lu ms", backoff_time);
~~~ ^~~~~~~~~~~~
%u
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
3 warnings generated.
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/platform/mbed_mem_trace.cpp:110:80: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
printf(MBED_MEM_DEFAULT_TRACER_PREFIX "m:%p;%p-%u\n", res, caller, temp_s1);
~~ ^~~~~~~
%zu
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/platform/mbed_mem_trace.cpp:116:93: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
printf(MBED_MEM_DEFAULT_TRACER_PREFIX "r:%p;%p-%p;%u\n", res, caller, temp_ptr, temp_s1);
~~ ^~~~~~~
%zu
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/platform/mbed_mem_trace.cpp:122:83: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
printf(MBED_MEM_DEFAULT_TRACER_PREFIX "c:%p;%p-%u;%u\n", res, caller, temp_s1, temp_s2);
~~ ^~~~~~~
%zu
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/platform/mbed_mem_trace.cpp:122:92: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
printf(MBED_MEM_DEFAULT_TRACER_PREFIX "c:%p;%p-%u;%u\n", res, caller, temp_s1, temp_s2);
~~ ^~~~~~~
%zu
4 warnings generated.
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/pelion-dm/pal_plat_rtos.cpp:18:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal.h:25:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal_configuration.h:49:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Configs/pal_config/mbedOS/mbedOS_default.h:46:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/device.h:33:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/objects.h:22:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/gpio_object.h:19:
In file included from /Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten.h:1:
In file included from /Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/emscripten.h:23:
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:101:1: error: templates must have C++ linkage
template<typename, typename = void> struct __em_asm_sig {};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal.h:22:1: note: extern "C" language linkage specification begins here
extern "C" {
^
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/pelion-dm/pal_plat_rtos.cpp:18:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal.h:25:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal_configuration.h:49:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Configs/pal_config/mbedOS/mbedOS_default.h:46:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/device.h:33:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/objects.h:22:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/gpio_object.h:19:
In file included from /Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten.h:1:
In file included from /Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/emscripten.h:23:
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: error: explicit specialization of undeclared template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'd'; };
^ ~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:103:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'd'; };
^ ~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:103:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:104:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:104:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:105:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:105:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:106:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:106:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:107:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:107:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:108:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~~~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:108:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:109:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:109:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:110:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:110:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:111:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions