pi400kb icon indicating copy to clipboard operation
pi400kb copied to clipboard

two asprintf warnings when building according instructions

Open Hermann-SW opened this issue 4 years ago • 2 comments

Building was fine, two warnings:

[ 17%] Building C object CMakeFiles/pi400kb.dir/libusbgx/src/usbg.c.o
/home/pi/pi400kb/libusbgx/src/usbg.c: In function \u2018usbg_allocate_config\u2019:
/home/pi/pi400kb/libusbgx/src/usbg.c:392:8: warning: implicit declaration of function \u2018asprintf\u2019; did you mean \u2018vsprintf\u2019? [-Wimplicit-function-declaration]
  ret = asprintf(&(c->name), "%s.%d", label, id);
        ^~~~~~~~
        vsprintf
[ 23%] Building C object CMakeFiles/pi400kb.dir/libusbgx/src/usbg_common.c.o
/home/pi/pi400kb/libusbgx/src/usbg_common.c: In function \u2018usbg_init_function\u2019:
/home/pi/pi400kb/libusbgx/src/usbg_common.c:306:8: warning: implicit declaration of function \u2018asprintf\u2019; did you mean \u2018vsprintf\u2019? [-Wimplicit-function-declaration]
  ret = asprintf(&(f->name), "%s.%s", type_name, instance);
        ^~~~~~~~
        vsprintf
[ 29%] Building C object CMakeFiles/pi400kb.dir/libusbgx/src/usbg_common_libconfig.c.o

Hermann-SW avatar Oct 13 '21 14:10 Hermann-SW

This is what I get for creating my own CMake library for libusbgx.

# for asprintf
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)
add_compile_definitions(_GNU_SOURCE)

Seems to fix it, I'll pop another commit to the pending mouse PR.

Gadgetoid avatar Oct 13 '21 14:10 Gadgetoid

You mentioned KVM, so I did this just for you :laughing:

https://github.com/Gadgetoid/pi400kb/pull/2/commits/8e77c8cb7bb23f6342a06e09f2ea75c73ad498fa

Gadgetoid avatar Oct 13 '21 15:10 Gadgetoid