You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The header file "declares" all the functions you're using, but the object file or library is responsible for "defining" them.
You need to add -lws2811 to instruct gcc to link against the ws2812 library and include the definitions of ws2811_fini. In the simplest sense this either smooshes your code and the library code together into a single executable (static linking) or allows gcc to create a binary that knows where to find the library file dynamic linking).
In advance, if you encounter that issue after linking the -lws2811 ('cause I did) :
$ gcc main.c -lws2811 -o test /usr/bin/ld: /usr/local/lib/libws2811.a(ws2811.c.o): in function ws2811_set_custom_gamma_factor: ws2811.c:(.text+0x2934): undefined reference to pow collect2: error: ld returned 1 exit status
Just link the math lib. into the cmd as follow :
$ gcc main.c -lws2811 -lm -o test
Gadgetoid
added
the
notice
Issues that are solved/do not require input, but preserved and marked of interest to users.
label
Jan 24, 2022
I did installed the library as described in the README by doing
However, if I want to compile my code with
gcc main.c -o test
, I getmain.c:(.text+0x18): undefined reference to 'ws2811_fini'
for example.My
main.c
:#include <ws2811/ws2811.h> int main(int argc, char const *argv[]) { return 0; }
The text was updated successfully, but these errors were encountered: