On 7/28/22 07:12, Daniel Silva wrote:
However --ldstaticflags returns the fltk installation to
link with "/usr/local/lib/libfltk.a", and doesn't return all
the fltk dependencies, so I got linking errors.
--ldstaticflags returns "/usr/local/lib/libfltk.a -lXrender
-lXft -lfontconfig -pthread -lpthread -lm -lX11"
But the first definition of LDLIBS var in fltk-config is
"LDLIBS=" -lm -lX11 -lXext -lpthread -lXinerama -lXfixes
-lXcursor -lXft -lXrender -lm -lfontconfig -ldl"
And works fine.
Here's what I get when I run fltk-config and use just
/usr/local/src/fltk-1.4.x-git/lib/libfltk.a -lXrender -lXcursor
-lXfixes -lXft -lfontconfig -lXinerama -pthread -lpthread -ldl
..which looks a lot like your correct flags.
IMPORTANT: Are you sure your Makefile is invoking fltk-config
with an absolute path
to the fltk-config in your app dir? e.g. /usr/you/project/fltk-1.4.x/fltk-config
It doesn't have
to be an absolute path, it can be
relative. Just as long
as it points to the specific version of FLTK your app is trying
to build with.
If you're just running 'fltk-config' (without a path), then
you're probably picking up
whatever random version of FLTK that's installed
machine and is in your PATH,
and that probably has very different build flags that are wrong
for your app.
to the correct fltk-config script, as there
will be one fltk-config for
each version of FLTK, so you have to run the matching one to the
compiling and linking against.
Also, if you have a version of fltk installed as part of the OS
on your machine
(e.g. with 'apt' or 'yum'), then be sure when you have #include
in your code that it's not picking up /usr/include/FL, as that
might not be
compatible with the FLTK you want to build with. This is why Ian
you do not install FLTK on a machine (yum/apt/etc) if you're
multiple FLTK versions; it can create all kinds of problems when
picked up during compile (e.g. /usr/include/FL) don't match the
you're linking with (e.g. /some/where/yourproject/fltk-1.4.x/..)