undefined reference to `sscanf'

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

cross mob
Anonymous
Not applicable

I am trying to build my App for BCM920737 using Wiced SDK and for some reason I am getting undefined reference to sscanf error even "stdio.h" is included at the top of source code. Strange that I do not have problems with sprintf() function which is located in the same library. I understand that this problem occurs when object files are linked together, so maybe I need to do something smart in my makefile? Are there any documentation or explanations about makefiles used in Wiced SDK? I am using WICED Smart 2.2 on Ubuntu 14.04.

Makefile contents:

#

# Copyright 2015, Broadcom Corporation

# All Rights Reserved.

#

# This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;

# the contents of this file may not be disclosed to third parties, copied

# or duplicated in any form, in whole or in part, without the prior

# written permission of Broadcom Corporation.

#

########################################################################

# Add Application sources here.

########################################################################

APP_SRC = Observer.c  ws_upgrade_ota.c ws_upgrade.c RouteRadio.c  BLESerial.c puart_lib.c 

VERBOSE=1

DEBUG=1

########################################################################

################ DO NOT MODIFY FILE BELOW THIS LINE ####################

########################################################################

# Devices that support central/scatternet role should include

# special central role patch library

APP_PATCHES_AND_LIBS += central_role_patches.a

Error log:

09:46:55 **** Build of configuration Release for project WICED-Smart-SDK ****

/home/lukas/Documents/WICED/WICED-Smart-SDK-2.2.1/WICED-Smart-SDK/make clean observer-BCM920737TAG_Q32 build UART=/dev/ttyUSB0

Cleaning...

Done

Compiling spar_setup.c

Compiling Observer.c

Compiling ws_upgrade_ota.c

Compiling ws_upgrade.c

Compiling RouteRadio.c

Compiling BLESerial.c

Compiling puart_lib.c

Compiling sparinit.c

VERBOSE is ON

Tool chain is GCC

Reading symbol table from ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/BLESerial.o:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/BLESerial.o

Compiling lib_installer.c

Reading symbol table from ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/Observer.o:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/Observer.o

Reading symbol table from ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/RouteRadio.o:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/RouteRadio.o

Reading symbol table from ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/puart_lib.o:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/puart_lib.o

Linking target ELF

Reading symbol table from ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/spar_setup.o:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/spar_setup.o

Reading symbol table from ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/sparinit.o:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/sparinit.o

Reading symbol table from ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/ws_upgrade.o:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/ws_upgrade.o

Reading symbol table from ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/ws_upgrade_ota.o:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/ws_upgrade_ota.o

Reading symbol table from ../tier2/brcm/libraries/lib/20737/central_role_patches.a:

../../Tools/ARM_GNU/bin/Linux64/arm-none-eabi-objdump -t ../tier2/brcm/libraries/lib/20737/central_role_patches.a

Found install_patch_addin_blecm_setAdvDuringConnEnable

Found install_patch_addin_blecenhandleConnParamUpdateReq

Lib installer done.

../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/Observer.o: In function `observer_create':

/home/lukas/Documents/WICED/WICED-Smart-SDK-2.2.1/WICED-Smart-SDK/Wiced-Smart/spar/../../Apps/observer/Observer.c:158: undefined reference to `scanf'

make[1]: *** [../../build/observer-BCM920737TAG_Q32-rom-ram-Wiced-release/A_20737A1-observer-rom-ram-spar.elf] Error 1

make: *** [observer-BCM920737TAG_Q32] Error 2

09:47:04 Build Finished (took 8s.989ms)

0 Likes
1 Solution
Anonymous
Not applicable

scanf and sscanf are not supported in the runtime C library

You will have to make your own equivalent over the UART

View solution in original post

2 Replies
Anonymous
Not applicable

scanf and sscanf are not supported in the runtime C library

You will have to make your own equivalent over the UART

lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Greblys,

  I have attached a C source that includes a couple of other Functions:  memset and strncmp that are often used in source in the SDK but appear to be missing from the C Library.  SDK2.2.1+ may actually have these but I know earlier versions did not so we include it with every project.

Regards,

Frank

Embedded Masters