I am trying to convert the Zephyr gsm_modem sample project to C++. If I include `gsm.c` without using `extern "C"{}` I get this error: `undefined reference to gsm_ppp_start(device const*)`. When I include `gsm.c` inside of `extern "C"{}` as the code shows below, I get a lot of errors. The build output is included below.
I expect that I should include <drivers/gsm_ppp.h> inside of an `extern "C"{}`, but that fails for me. What am I missing here? It looks like it should be something simple. Can I even use GSM PPP driver in C++?
Zephyr Version: 2.6.99, build: v2.6.99-ncs1-rc2-5-ga64e96d17cc7
Assembler: gcc-arm-none-eabi-9-2019-q4-major
main.cpp
#ifdef __cplusplus extern "C" { #include "gsm.c" } #endif int main(void) { init_gsm(); return 0; }
gsm.c
/** * GSM Modem */ #include <zephyr.h> #include <sys/printk.h> #include <shell/shell.h> #include <drivers/uart.h> #include <net/net_mgmt.h> #include <net/net_event.h> #include <net/net_conn_mgr.h> #include <drivers/gsm_ppp.h> #include <logging/log.h> LOG_MODULE_REGISTER(gsm, LOG_LEVEL_DBG); /** * GSM Modem */ static const struct device *gsm_dev; static struct net_mgmt_event_callback mgmt_cb; static bool connected; static bool starting = true; static int cmd_sample_modem_suspend(const struct shell *shell, size_t argc, char *argv[]) { if (!connected) { shell_fprintf(shell, SHELL_NORMAL, "Not connected.\n"); return -ENOEXEC; } gsm_ppp_stop(gsm_dev); return 0; } static int cmd_sample_modem_resume(const struct shell *shell, size_t argc, char *argv[]) { if (starting) { shell_fprintf(shell, SHELL_NORMAL, "Please wait for network connection.\n"); return -ENOEXEC; } if (connected) { shell_fprintf(shell, SHELL_NORMAL, "Already connected.\n"); return -ENOEXEC; } gsm_ppp_start(gsm_dev); return 0; } SHELL_STATIC_SUBCMD_SET_CREATE(sample_commands, SHELL_CMD(resume, NULL, "Resume the modem\n", cmd_sample_modem_resume), SHELL_CMD(suspend, NULL, "Suspend the modem\n", cmd_sample_modem_suspend), SHELL_SUBCMD_SET_END ); SHELL_CMD_REGISTER(sample, &sample_commands, "Sample application commands", NULL); static void event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { if ((mgmt_event & (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED)) != mgmt_event) { return; } starting = false; if (mgmt_event == NET_EVENT_L4_CONNECTED) { LOG_INF("Network connected"); connected = true; return; } if (mgmt_event == NET_EVENT_L4_DISCONNECTED) { LOG_INF("Network disconnected"); connected = false; return; } } int init_gsm() { const struct device *uart_dev = device_get_binding(CONFIG_MODEM_GSM_UART_NAME); gsm_dev = device_get_binding(GSM_MODEM_DEVICE_NAME); LOG_INF("Board '%s' APN '%s' UART '%s' device %p (%s)", CONFIG_BOARD, CONFIG_MODEM_GSM_APN, CONFIG_MODEM_GSM_UART_NAME, uart_dev, GSM_MODEM_DEVICE_NAME); net_mgmt_init_event_callback(&mgmt_cb, event_handler, NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED); net_mgmt_add_event_callback(&mgmt_cb); return 0; }
prj.conf:
# straig out of sample gsm-modemproject with C++ support. # UART support CONFIG_SERIAL=y CONFIG_CPLUSPLUS=y CONFIG_NEWLIB_LIBC=y # GSM modem support CONFIG_MODEM=y CONFIG_MODEM_GSM_PPP=y CONFIG_MODEM_GSM_UART_NAME="UART_0" # PPP networking support CONFIG_NET_PPP=y CONFIG_NET_L2_PPP=y CONFIG_NET_NATIVE=y CONFIG_NETWORKING=y CONFIG_NET_L2_PPP_TIMEOUT=10000 # IPv4 enables PPP IPCP support CONFIG_NET_IPV4=y CONFIG_NET_IPV6=n # Network management events CONFIG_NET_CONNECTION_MANAGER=y # Log buffers, modem and PPP CONFIG_LOG=y CONFIG_NET_LOG=y CONFIG_NET_SHELL=y CONFIG_MODEM_SHELL=y
Build Output with `extern "C"{}`:
west build -b nrf5340dk_nrf5340_cpunet -p always -- west build: making build dir /home/code-magic/code-github/zephyr-gsm-modem/build pristine -- west build: generating a build system Including boilerplate (Zephyr base): /home/code-magic/ncs/zephyr/cmake/app/boilerplate.cmake CMake Deprecation Warning at /home/code-magic/ncs/zephyr/cmake/app/boilerplate.cmake:37 (cmake_policy): The OLD behavior for policy CMP0079 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. Call Stack (most recent call first): /home/code-magic/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include) /home/code-magic/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate) CMakeLists.txt:5 (find_package) -- Application: /home/code-magic/code-github/zephyr-gsm-modem -- Zephyr version: 2.6.99 (/home/code-magic/ncs/zephyr), build: v2.6.99-ncs1-rc2-5-ga64e96d17cc7 -- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.10") found components: Interpreter -- Found west (found suitable version "0.11.1", minimum required is "0.7.1") -- Board: nrf5340dk_nrf5340_cpunet -- Cache files will be written to: /home/code-magic/.cache/zephyr -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6") -- Found toolchain: gnuarmemb (/home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major) -- Found BOARD.dts: /home/code-magic/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts -- Found devicetree overlay: /home/code-magic/code-github/zephyr-gsm-modem/boards/nrf5340dk_nrf5340_cpunet.overlay -- Generated zephyr.dts: /home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/zephyr.dts -- Generated devicetree_unfixed.h: /home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/include/generated/devicetree_unfixed.h -- Generated device_extern.h: /home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/include/generated/device_extern.h -- Including generated dts.cmake file: /home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/dts.cmake Parsing /home/code-magic/ncs/zephyr/Kconfig Loaded configuration '/home/code-magic/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet_defconfig' Merged configuration '/home/code-magic/code-github/zephyr-gsm-modem/prj.conf' Configuration saved to '/home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/.config' Kconfig header saved to '/home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/include/generated/autoconf.h' warning: TEST_RANDOM_GENERATOR (defined at subsys/random/Kconfig:8) was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: (!ENTROPY_HAS_DRIVER) (=n). See http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_TEST_RANDOM_GENERATOR.html and/or look up TEST_RANDOM_GENERATOR in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too. -- The C compiler identification is GNU 9.2.1 -- The CXX compiler identification is GNU 9.2.1 -- The ASM compiler identification is GNU -- Found assembler: /home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc CMake Warning at /home/code-magic/ncs/zephyr/CMakeLists.txt:718 (message): No SOURCES given to Zephyr library: drivers__serial Excluding target from build. -- Configuring done -- Generating done -- Build files have been written to: /home/code-magic/code-github/zephyr-gsm-modem/build -- west build: building application [1/297] Preparing syscall dependency handling [67/297] Building CXX object CMakeFiles/app.dir/src/main.cpp.obj FAILED: CMakeFiles/app.dir/src/main.cpp.obj ccache /home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-g++ -DBUILD_VERSION=v2.6.99-ncs1-rc2-5-ga64e96d17cc7 -DKERNEL -DMBEDTLS_CONFIG_FILE=\"config-tls-generic.h\" -DNRF5340_XXAA_NETWORK -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/code-magic/code-github/zephyr-gsm-modem/include -I/home/code-magic/code-github/zephyr-gsm-modem/../RPMsg -I/home/code-magic/ncs/zephyr/include -I/home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/include/generated -I/home/code-magic/ncs/zephyr/soc/arm/nordic_nrf/nrf53 -I/home/code-magic/ncs/zephyr/lib/libc/newlib/include -I/home/code-magic/ncs/zephyr/lib/util/fnmatch/. -I/home/code-magic/ncs/zephyr/subsys/net/lib/sockets/. -I/home/code-magic/ncs/zephyr/subsys/net/lib/conn_mgr/. -I/home/code-magic/ncs/zephyr/subsys/net/lib/dns/. -I/home/code-magic/ncs/nrf/include -I/home/code-magic/ncs/modules/hal/cmsis/CMSIS/Core/Include -I/home/code-magic/ncs/modules/hal/nordic/nrfx -I/home/code-magic/ncs/modules/hal/nordic/nrfx/drivers/include -I/home/code-magic/ncs/modules/hal/nordic/nrfx/mdk -I/home/code-magic/ncs/zephyr/modules/hal_nordic/nrfx/. -I/home/code-magic/ncs/modules/crypto/mbedtls/mbedtls/include -I/home/code-magic/ncs/zephyr/modules/mbedtls/configs -isystem /home/code-magic/ncs/zephyr/subsys/cpp/include -Os -fcheck-new -std=c++17 -Wno-register -fno-exceptions -fno-rtti -imacros /home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33+nodsp -mthumb -mabi=aapcs -imacros /home/code-magic/ncs/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/code-magic/code-github/zephyr-gsm-modem=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/code-magic/ncs/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/code-magic/ncs=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -MD -MT CMakeFiles/app.dir/src/main.cpp.obj -MF CMakeFiles/app.dir/src/main.cpp.obj.d -o CMakeFiles/app.dir/src/main.cpp.obj -c /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp In file included from /home/code-magic/ncs/zephyr/include/sys/cbprintf_internal.h:58, from /home/code-magic/ncs/zephyr/include/sys/cbprintf.h:38, from /home/code-magic/ncs/zephyr/include/logging/log_msg2.h:11, from /home/code-magic/ncs/zephyr/include/logging/log_msg.h:12, from /home/code-magic/ncs/zephyr/include/logging/log_backend.h:9, from /home/code-magic/ncs/zephyr/include/shell/shell_log_backend.h:11, from /home/code-magic/ncs/zephyr/include/shell/shell.h:14, from /home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:6, from /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:14: /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:17:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const char*)' 17 | static inline int z_cbprintf_cxx_is_pchar(const char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:12:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(char*)' 12 | static inline int z_cbprintf_cxx_is_pchar(char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:22:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(volatile char*)' 22 | static inline int z_cbprintf_cxx_is_pchar(volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:17:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const char*)' 17 | static inline int z_cbprintf_cxx_is_pchar(const char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:22:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(volatile char*)' 22 | static inline int z_cbprintf_cxx_is_pchar(volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:12:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(char*)' 12 | static inline int z_cbprintf_cxx_is_pchar(char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:27:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile char*)' 27 | static inline int z_cbprintf_cxx_is_pchar(const volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:22:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(volatile char*)' 22 | static inline int z_cbprintf_cxx_is_pchar(volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:27:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile char*)' 27 | static inline int z_cbprintf_cxx_is_pchar(const volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:17:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const char*)' 17 | static inline int z_cbprintf_cxx_is_pchar(const char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:27:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile char*)' 27 | static inline int z_cbprintf_cxx_is_pchar(const volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:12:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(char*)' 12 | static inline int z_cbprintf_cxx_is_pchar(char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:32:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(wchar_t*)' 32 | static inline int z_cbprintf_cxx_is_pchar(wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:27:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const volatile char*)' 27 | static inline int z_cbprintf_cxx_is_pchar(const volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:32:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(wchar_t*)' 32 | static inline int z_cbprintf_cxx_is_pchar(wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:22:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(volatile char*)' 22 | static inline int z_cbprintf_cxx_is_pchar(volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:32:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(wchar_t*)' 32 | static inline int z_cbprintf_cxx_is_pchar(wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:17:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const char*)' 17 | static inline int z_cbprintf_cxx_is_pchar(const char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:32:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(wchar_t*)' 32 | static inline int z_cbprintf_cxx_is_pchar(wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:12:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(char*)' 12 | static inline int z_cbprintf_cxx_is_pchar(char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:37:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const wchar_t*)' 37 | static inline int z_cbprintf_cxx_is_pchar(const wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:32:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(wchar_t*)' 32 | static inline int z_cbprintf_cxx_is_pchar(wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:37:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const wchar_t*)' 37 | static inline int z_cbprintf_cxx_is_pchar(const wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:27:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const volatile char*)' 27 | static inline int z_cbprintf_cxx_is_pchar(const volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:37:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const wchar_t*)' 37 | static inline int z_cbprintf_cxx_is_pchar(const wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:22:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(volatile char*)' 22 | static inline int z_cbprintf_cxx_is_pchar(volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:37:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const wchar_t*)' 37 | static inline int z_cbprintf_cxx_is_pchar(const wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:17:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const char*)' 17 | static inline int z_cbprintf_cxx_is_pchar(const char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:37:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const wchar_t*)' 37 | static inline int z_cbprintf_cxx_is_pchar(const wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:12:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(char*)' 12 | static inline int z_cbprintf_cxx_is_pchar(char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:42:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(volatile wchar_t*)' 42 | static inline int z_cbprintf_cxx_is_pchar(volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:37:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const wchar_t*)' 37 | static inline int z_cbprintf_cxx_is_pchar(const wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:42:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(volatile wchar_t*)' 42 | static inline int z_cbprintf_cxx_is_pchar(volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:32:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(wchar_t*)' 32 | static inline int z_cbprintf_cxx_is_pchar(wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:42:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(volatile wchar_t*)' 42 | static inline int z_cbprintf_cxx_is_pchar(volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:27:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const volatile char*)' 27 | static inline int z_cbprintf_cxx_is_pchar(const volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:42:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(volatile wchar_t*)' 42 | static inline int z_cbprintf_cxx_is_pchar(volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:22:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(volatile char*)' 22 | static inline int z_cbprintf_cxx_is_pchar(volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:42:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(volatile wchar_t*)' 42 | static inline int z_cbprintf_cxx_is_pchar(volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:17:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const char*)' 17 | static inline int z_cbprintf_cxx_is_pchar(const char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:42:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(volatile wchar_t*)' 42 | static inline int z_cbprintf_cxx_is_pchar(volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:12:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(char*)' 12 | static inline int z_cbprintf_cxx_is_pchar(char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:47:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile wchar_t*)' 47 | static inline int z_cbprintf_cxx_is_pchar(const volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:42:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(volatile wchar_t*)' 42 | static inline int z_cbprintf_cxx_is_pchar(volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:47:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile wchar_t*)' 47 | static inline int z_cbprintf_cxx_is_pchar(const volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:37:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const wchar_t*)' 37 | static inline int z_cbprintf_cxx_is_pchar(const wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:47:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile wchar_t*)' 47 | static inline int z_cbprintf_cxx_is_pchar(const volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:32:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(wchar_t*)' 32 | static inline int z_cbprintf_cxx_is_pchar(wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:47:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile wchar_t*)' 47 | static inline int z_cbprintf_cxx_is_pchar(const volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:27:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const volatile char*)' 27 | static inline int z_cbprintf_cxx_is_pchar(const volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:47:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile wchar_t*)' 47 | static inline int z_cbprintf_cxx_is_pchar(const volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:22:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(volatile char*)' 22 | static inline int z_cbprintf_cxx_is_pchar(volatile char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:47:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile wchar_t*)' 47 | static inline int z_cbprintf_cxx_is_pchar(const volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:17:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(const char*)' 17 | static inline int z_cbprintf_cxx_is_pchar(const char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:47:19: error: conflicting declaration of C function 'int z_cbprintf_cxx_is_pchar(const volatile wchar_t*)' 47 | static inline int z_cbprintf_cxx_is_pchar(const volatile wchar_t *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:12:19: note: previous declaration 'int z_cbprintf_cxx_is_pchar(char*)' 12 | static inline int z_cbprintf_cxx_is_pchar(char *) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:52:1: error: template with C linkage 52 | template < typename T > | ^~~~~~~~ /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:13:1: note: 'extern "C"' linkage started here 13 | extern "C" { | ^~~~~~~~~~ In file included from /home/code-magic/ncs/zephyr/include/sys/cbprintf_internal.h:58, from /home/code-magic/ncs/zephyr/include/sys/cbprintf.h:38, from /home/code-magic/ncs/zephyr/include/logging/log_msg2.h:11, from /home/code-magic/ncs/zephyr/include/logging/log_msg.h:12, from /home/code-magic/ncs/zephyr/include/logging/log_backend.h:9, from /home/code-magic/ncs/zephyr/include/shell/shell_log_backend.h:11, from /home/code-magic/ncs/zephyr/include/shell/shell.h:14, from /home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:6, from /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:14: /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:69:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_arg_size(void*)' 69 | static inline size_t z_cbprintf_cxx_arg_size(void *p) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:62:22: note: previous declaration 'size_t z_cbprintf_cxx_arg_size(float)' 62 | static inline size_t z_cbprintf_cxx_arg_size(float f) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:76:1: error: template with C linkage 76 | template < typename T > | ^~~~~~~~ /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:13:1: note: 'extern "C"' linkage started here 13 | extern "C" { | ^~~~~~~~~~ In file included from /home/code-magic/ncs/zephyr/include/sys/cbprintf_internal.h:58, from /home/code-magic/ncs/zephyr/include/sys/cbprintf.h:38, from /home/code-magic/ncs/zephyr/include/logging/log_msg2.h:11, from /home/code-magic/ncs/zephyr/include/logging/log_msg.h:12, from /home/code-magic/ncs/zephyr/include/logging/log_backend.h:9, from /home/code-magic/ncs/zephyr/include/shell/shell_log_backend.h:11, from /home/code-magic/ncs/zephyr/include/shell/shell.h:14, from /home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:6, from /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:14: /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:91:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, void*)' 91 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, void *p) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:83:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, float)' 83 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:96:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, char)' 96 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:91:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, void*)' 91 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, void *p) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:96:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, char)' 96 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:83:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, float)' 83 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:103:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, unsigned char)' 103 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:96:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, char)' 96 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:103:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, unsigned char)' 103 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:91:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, void*)' 91 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, void *p) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:103:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, unsigned char)' 103 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:83:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, float)' 83 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:110:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, signed char)' 110 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, signed char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:103:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, unsigned char)' 103 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:110:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, signed char)' 110 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, signed char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:96:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, char)' 96 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:110:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, signed char)' 110 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, signed char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:91:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, void*)' 91 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, void *p) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:110:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, signed char)' 110 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, signed char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:83:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, float)' 83 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:117:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short int)' 117 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:110:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, signed char)' 110 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, signed char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:117:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short int)' 117 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:103:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, unsigned char)' 103 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:117:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short int)' 117 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:96:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, char)' 96 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:117:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short int)' 117 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:91:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, void*)' 91 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, void *p) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:117:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short int)' 117 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:83:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, float)' 83 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:124:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short unsigned int)' 124 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:117:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, short int)' 117 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:124:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short unsigned int)' 124 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:110:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, signed char)' 110 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, signed char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:124:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short unsigned int)' 124 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:103:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, unsigned char)' 103 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:124:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short unsigned int)' 124 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:96:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, char)' 96 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, char arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:124:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short unsigned int)' 124 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:91:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, void*)' 91 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, void *p) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:124:20: error: conflicting declaration of C function 'void z_cbprintf_cxx_store_arg(uint8_t*, short unsigned int)' 124 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, unsigned short arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:83:20: note: previous declaration 'void z_cbprintf_cxx_store_arg(uint8_t*, float)' 83 | static inline void z_cbprintf_cxx_store_arg(uint8_t *dst, float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:131:1: error: template with C linkage 131 | template < typename T > | ^~~~~~~~ /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:13:1: note: 'extern "C"' linkage started here 13 | extern "C" { | ^~~~~~~~~~ In file included from /home/code-magic/ncs/zephyr/include/sys/cbprintf_internal.h:58, from /home/code-magic/ncs/zephyr/include/sys/cbprintf.h:38, from /home/code-magic/ncs/zephyr/include/logging/log_msg2.h:11, from /home/code-magic/ncs/zephyr/include/logging/log_msg.h:12, from /home/code-magic/ncs/zephyr/include/logging/log_backend.h:9, from /home/code-magic/ncs/zephyr/include/shell/shell_log_backend.h:11, from /home/code-magic/ncs/zephyr/include/shell/shell.h:14, from /home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:6, from /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:14: /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:147:1: error: template with C linkage 147 | template < typename T > | ^~~~~~~~ /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:13:1: note: 'extern "C"' linkage started here 13 | extern "C" { | ^~~~~~~~~~ In file included from /home/code-magic/ncs/zephyr/include/sys/cbprintf_internal.h:58, from /home/code-magic/ncs/zephyr/include/sys/cbprintf.h:38, from /home/code-magic/ncs/zephyr/include/logging/log_msg2.h:11, from /home/code-magic/ncs/zephyr/include/logging/log_msg.h:12, from /home/code-magic/ncs/zephyr/include/logging/log_backend.h:9, from /home/code-magic/ncs/zephyr/include/shell/shell_log_backend.h:11, from /home/code-magic/ncs/zephyr/include/shell/shell.h:14, from /home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:6, from /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:14: /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:163:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(double)' 163 | static inline size_t z_cbprintf_cxx_alignment(double arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:156:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(float)' 156 | static inline size_t z_cbprintf_cxx_alignment(float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:170:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long double)' 170 | static inline size_t z_cbprintf_cxx_alignment(long double arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:163:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(double)' 163 | static inline size_t z_cbprintf_cxx_alignment(double arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:170:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long double)' 170 | static inline size_t z_cbprintf_cxx_alignment(long double arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:156:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(float)' 156 | static inline size_t z_cbprintf_cxx_alignment(float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:177:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long long int)' 177 | static inline size_t z_cbprintf_cxx_alignment(long long arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:170:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(long double)' 170 | static inline size_t z_cbprintf_cxx_alignment(long double arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:177:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long long int)' 177 | static inline size_t z_cbprintf_cxx_alignment(long long arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:163:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(double)' 163 | static inline size_t z_cbprintf_cxx_alignment(double arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:177:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long long int)' 177 | static inline size_t z_cbprintf_cxx_alignment(long long arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:156:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(float)' 156 | static inline size_t z_cbprintf_cxx_alignment(float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:184:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long long unsigned int)' 184 | static inline size_t z_cbprintf_cxx_alignment(unsigned long long arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:177:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(long long int)' 177 | static inline size_t z_cbprintf_cxx_alignment(long long arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:184:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long long unsigned int)' 184 | static inline size_t z_cbprintf_cxx_alignment(unsigned long long arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:170:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(long double)' 170 | static inline size_t z_cbprintf_cxx_alignment(long double arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:184:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long long unsigned int)' 184 | static inline size_t z_cbprintf_cxx_alignment(unsigned long long arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:163:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(double)' 163 | static inline size_t z_cbprintf_cxx_alignment(double arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:184:22: error: conflicting declaration of C function 'size_t z_cbprintf_cxx_alignment(long long unsigned int)' 184 | static inline size_t z_cbprintf_cxx_alignment(unsigned long long arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:156:22: note: previous declaration 'size_t z_cbprintf_cxx_alignment(float)' 156 | static inline size_t z_cbprintf_cxx_alignment(float arg) | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/code-magic/ncs/zephyr/include/sys/cbprintf_cxx.h:191:1: error: template with C linkage 191 | template < typename T > | ^~~~~~~~ /home/code-magic/code-github/zephyr-gsm-modem/src/main.cpp:13:1: note: 'extern "C"' linkage started here 13 | extern "C" { | ^~~~~~~~~~ [69/297] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/net/lib/sockets/getnameinfo.c.obj ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/code-magic/code-github/zephyr-gsm-modem/build
Build Output without `extern C{}`:
[290/297] Linking CXX executable zephyr/zephyr_prebuilt.elf FAILED: zephyr/zephyr_prebuilt.elf zephyr/zephyr_prebuilt.map /home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/zephyr_prebuilt.map : && ccache /home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-g++ zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -Wl,-T zephyr/linker_zephyr_prebuilt.cmd -Wl,-Map=/home/code-magic/code-github/zephyr-gsm-modem/build/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a zephyr/lib/libc/newlib/liblib__libc__newlib.a zephyr/lib/posix/liblib__posix.a zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/subsys/net/libsubsys__net.a zephyr/subsys/net/l2/ppp/libsubsys__net__l2__ppp.a zephyr/subsys/net/ip/libsubsys__net__ip.a zephyr/subsys/net/lib/config/libsubsys__net__lib__config.a zephyr/subsys/net/lib/conn_mgr/libsubsys__net__lib__conn_mgr.a zephyr/subsys/net/lib/dns/libsubsys__net__lib__dns.a zephyr/subsys/random/libsubsys__random.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/entropy/libdrivers__entropy.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a modules/mbedtls/libmodules__mbedtls.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"/home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v8-m.main/nofp" -L/home/code-magic/code-github/zephyr-gsm-modem/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m33+nodsp -mthumb -mabi=aapcs -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -lm -Wl,-lc -L"/home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi"/lib/thumb/v8-m.main/nofp -Wl,-lgcc -lc -specs=nano.specs && cd /home/code-magic/code-github/zephyr-gsm-modem/build/zephyr && /usr/bin/cmake -E echo /home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.bfd: app/libapp.a(gsm.c.obj):/home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:14: multiple definition of `log_dynamic_gsm'; app/libapp.a(main.cpp.obj):/home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:14: first defined here /home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.bfd: app/libapp.a(gsm.c.obj):/home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:14: multiple definition of `log_const_gsm'; app/libapp.a(main.cpp.obj):/home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:14: first defined here /home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.bfd: app/libapp.a(main.cpp.obj): in function `cmd_sample_modem_suspend(shell const*, unsigned int, char**)': /home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:33: undefined reference to `gsm_ppp_stop(device const*)' /home/code-magic/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.bfd: app/libapp.a(main.cpp.obj): in function `cmd_sample_modem_resume(shell const*, unsigned int, char**)': /home/code-magic/code-github/zephyr-gsm-modem/src/gsm.c:52: undefined reference to `gsm_ppp_start(device const*)' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/code-magic/code-github/zephyr-gsm-modem/build