MoAlyousef / cfltk

C Bindings for FLTK
MIT License
78 stars 21 forks source link

Symbol 'Fl_Widget_set_label' not found, undifined reference to symbol #209

Closed rempas closed 2 years ago

rempas commented 2 years ago

I don't know if I'm doing something wrong but I have compiled and installed both fltk and cfltk using GNU Make after I generated the Makefile using Cmake.

I'm using the example program and CMakeLists.txt that have been taken from "README.md" and I try to compile the program but I'm getting an error that the compiler cannot find the 'Fl_Widget_set_label' symbol and also I'm also getting an error about an undefined symbol called "dlsym@@GLIBC_2.2.5"

If you need more specific info:

OS: Linux Lite 5.6

Command used to compile: gcc ex.c -o ex -lcfltk -lfltk -lpthread -lX11 -lpango-1.0 -lpangoxft-1.0 -lgobject-2.0 -lcairo -lpangocairo-1.0 -lfltk_images -lfltk_jpeg // I also tried with "tcc" as the compiler

Exact error output::

ex.c: In function ‘cb’:
ex.c:7:37: warning: implicit declaration of function ‘Fl_Widget_set_label’; did you mean ‘Fl_Window_set_label’? [-Wimplicit-function-declaration]
    7 | void cb(Fl_Widget *w, void *data) { Fl_Widget_set_label(w, "Works!"); }
      |                                     ^~~~~~~~~~~~~~~~~~~
      |                                     Fl_Window_set_label
/usr/bin/ld: /usr/local/lib/libfltk.a(Fl_X11_Window_Driver.cxx.o): undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
MoAlyousef commented 2 years ago

You’ll need to include cfl_widget.h to the code. I’ll update the Readme example.

You also need to pass -ldl to the linker.

rempas commented 2 years ago

Thanks man!!! It works great!!! I can now use FLTK with tcc ;)