Albrecht Schlosser wrote:

- snip -
>> Duncan Gibson wrote:
>> 
>> My apologies, but it's not obvious to some people who post here.
>> 
>> Some people also come unstuck by having multiple versions of fltk-1.1.x
>> and/or fltk-1.3.x installed where include files and libraries might not
>> match or where they built and installed them with different options.
>> 
>> Final suggestion from me:
>> Does fltk-config* --ldflags return non-standard -L options that you
>> will need to give to the linker so that it can find the libraries?
> 
> ... and two more from me:
> 
> Is there any chance that your installed libs (you wrote that you
> "installed" them, i.e. did not compile them yourself?) might have been
> compiled with a different compiler version? If so, try compiling them
> yourself and see what happens.
> 
> It is also not obvious if you tried to link with gcc/g++ before you tried
> to use ld. I don't know what happens "under the hood", but generally it
> is not recommended to link with ld, but instead use the compiler frontend
> to drive the linker, e.g.
> 
> g++ -o hello hello.cxx `fltk(2)-config --cxxflags --ldflags` should work.
> 
> If this doesn't work, please post the exact error messages.
> 
> You can even use the generated fltk(2)-config in the fltk source directory
> without installing it for testing. That's what I do often to compile and
> link with different fltk (test/development) versions.
> 
> Albrecht

@Duncan: Sorry, there's nothing you have to apologies for, I have to. My
writing wasn't as polite as should have been. I don't get rid of that
problem for days. And that drives me crazy.

I got the sources from the subversion repository (revision 6672). I compiled
it on the same maschine and installed it immidiatly thereafter.

> make
> sudo make install

I use g++ as frontend. I write ld to make clear I mean the link phase.

Well, by now things become even more rediculous. The single line Albrecht
suggested works. But doing it with make in two steps doesn't. The -t option
to ld doesn't make any differnce, but shows that ld seems to ignore
libfltk.a because it doesn't appear in the output.

Any more ideas?

Thanks, Dieter



---------------- makefile:
CC = g++

CXXFLAGS = -I/usr/local/include -I/usr/include/freetype2
-I/usr/X11R6/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT

LDFLAGS = -t -L/usr/local/lib -L/usr/X11R6/lib -lfltk -lXext -lXft
-lfontconfig -lXinerama -lpthread -ldl -lm -lX11

hello : hello.o

end makefile -----------------

> fltk-config --cxxflags
-I/usr/local/include -I/usr/include/freetype2 -I/usr/X11R6/include
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-D_THREAD_SAFE -D_REENTRANT

> fltk-config --ldflags
-L/usr/local/lib -L/usr/X11R6/lib -lfltk -lXext -lXft -lfontconfig
-lXinerama -lpthread -ldl -lm -lX11

> make
g++ -I/usr/local/include -I/usr/include/freetype2 -I/usr/X11R6/include
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-D_THREAD_SAFE -D_REENTRANT   -c -o hello.o hello.cpp
g++ -t -L/usr/local/lib -L/usr/X11R6/lib -lfltk -lXext -lXft -lfontconfig
-lXinerama -lpthread -ldl -lm -lX11  hello.o   -o hello
hello.o: In function `main':
hello.cpp:(.text+0x40): undefined reference to `Fl_Window::Fl_Window(int,
int, char const*)'
hello.cpp:(.text+0xd9): undefined reference to `fl_define_FL_SHADOW_LABEL()'
hello.cpp:(.text+0xf5): undefined reference to `Fl_Group::end()'
hello.cpp:(.text+0x109): undefined reference to `Fl_Window::show(int,
char**)'
hello.cpp:(.text+0x111): undefined reference to `Fl::run()'
hello.o: In function `Fl_Box::Fl_Box(int, int, int, int, char const*)':
hello.cpp:(.gnu.linkonce.t._ZN6Fl_BoxC1EiiiiPKc[Fl_Box::Fl_Box(int, int,
int, int, char const*)]+0x1d): undefined reference to
`Fl_Widget::Fl_Widget(int, int, int, int, char const*)'
hello.cpp:(.gnu.linkonce.t._ZN6Fl_BoxC1EiiiiPKc[Fl_Box::Fl_Box(int, int,
int, int, char const*)]+0x25): undefined reference to `vtable for Fl_Box'
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: link
errors found, deleting executable `hello'
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: mode
elf_i386
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../crt1.o
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../crti.o
/usr/lib/gcc/i586-suse-linux/4.0.2/crtbegin.o
-lXext (/usr/X11R6/lib/libXext.so)
-lXft (/usr/X11R6/lib/libXft.so)
-lfontconfig (/usr/lib/gcc/i586-suse-linux/4.0.2/../../../libfontconfig.so)
-lXinerama (/usr/X11R6/lib/libXinerama.so)
/lib/libpthread.so.0
-ldl (/usr/lib/gcc/i586-suse-linux/4.0.2/../../../libdl.so)
-lX11 (/usr/X11R6/lib/libX11.so)
hello.o
-lstdc++ (/usr/lib/gcc/i586-suse-linux/4.0.2/../../../libstdc++.so)
-lm (/usr/lib/gcc/i586-suse-linux/4.0.2/../../../libm.so)
-lgcc_s (/usr/lib/gcc/i586-suse-linux/4.0.2/../../../libgcc_s.so)
/lib/libc.so.6
(/usr/lib/libc_nonshared.a)elf-init.oS
-lgcc_s (/usr/lib/gcc/i586-suse-linux/4.0.2/../../../libgcc_s.so)
/usr/lib/gcc/i586-suse-linux/4.0.2/crtend.o
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../crtn.o
collect2: ld returned 1 exit status
make: *** [hello] Fehler 1

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to