Undefined link to __isoc99_sscanf

I have a static C library libex.athat uses sscanf. The library was compiled with-std=c99

I want to use a library function in some C ++ code that I compile with -std=c++11, but I get the following error:

lib/libex.a(srcfile.o): In function `my_function':
/srcpath/srcfile.c:215: undefined reference to `__isoc99_sscanf'

After a bit of work, I found that it sscanfhad version problems due to a hack of backward compatibility, so the redirect to __isoc99_sscanf, so I suspect that this is somehow the source of the problem. Nevertheless, I checked my version glibcand it looks quite recently that the proposed solution elsewhere (updating your copy glibcto at least 2.7) does not help.

$ ldd --version
ldd (Ubuntu EGLIBC 2.19-0ubuntu6.6) 2.19

Any suggestions?

Of course, let me know if there is any additional information that will be relevant.

Thank!

UPDATE: if I compile libex.awith -D_GNU_SOURCE, the error message will be changed to undefined reference to sscanf. Not sure if this will help figure out what is going wrong.

+4
source share
1 answer

If anyone else encounters this problem:

The makefile for C ++ code disabled standard libraries and started files using flags -nostdlib -nodefaultlibs -nostartfiles. Instead, it is associated with the version stdio.hincluded in the Intel SGX SDK for working inside enclaves. This version is discounting sscanf.

0
source

Source: https://habr.com/ru/post/1653224/


All Articles