Solved it. Apparantely Ubuntu 9.10 has a libfltk.so which it interprets as
-lfltk and also has a fltk-config command. Since the default parameters of the
fltk manual install are set to /usr/local, the newly installed fltk-config
wasn't being called. So I manually called it through the terminal and also had
the include files changed as follows:
<Program>
#include </usr/local/include/FL/Fl.H>
#include </usr/local/include/FL/Fl_Window.H>
#include </usr//local/include/FL/Fl_Box.H>
int main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(300,180);
Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
box->box(FL_UP_BOX);
box->labelsize(36);
box->labelfont(FL_BOLD);
box->labeltype(FL_SHADOW_LABEL);
window->end();
window->show(argc, argv);
return Fl::run();
}
<Terminal Commands>
on...@onkar-laptop:~/workspace$ /usr/local/bin/fltk-config --compile
fltk_simple_install_test.cxx
g++ -I/usr/local/include -I/usr/include/freetype2 -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT -o
'fltk_simple_install_test' 'fltk_simple_install_test.cxx'
/usr/local/lib/libfltk.a -lXext -lXft -lfontconfig -lXinerama -lpthread -ldl
-lm -lX11
on...@onkar-laptop:~/workspace$ ./fltk_simple_install_test
Hope that this might help in the future.
Thanks for the troubleshooting help guys. Helped me rethink a few things.
Regards,
Onkar Raut.
> On 8 July 2010 23:01, Onkar Raut <[email protected]> wrote:
>
> > =C2=A0I've used the sample code from "Chapter 4.1 Writing Your First FLTK=
> Program" of the FLTK documentation.
> >
>
> Note that fltk-2 is not currently in active maintenance and is
> generally considered alpha. If you want a stable baseline you should
> probably use the fltk-1.1.10 release.
>
> The current active development branch is fltk-1.3, so that is a good choice=
> too.
>
> > Here's how i'm compiling, linking the program and getting the correspondi=
> ng error:
> >
> > <compiling>
> > g++ -g -c -I/usr/local/include ./fltk_simple_install_test.c
> >
>
> Is that a typo? Your source file is named as a .c file. That will
> probably cause gcc to treat it as C rather than C++ so the symbol
> names will be mangled wrongly.
>
> You should give your file a C++ name that the compiler recognizes, the
> fltk default is .cxx, though .cpp or .cc are both popular alternates.
>
> >
> > <linking>
> > g++ -g fltk_simple_install_test.o -o ./fltk_simple_install_test /usr/loca=
> l/lib/libfltk.a -lXext -lX11 -lm
> >
>
> Another typo? I thought you indicated that you were using fltk-2, but
> that is the fltk-1 lib you are linking against...?
>
> In any case, if you are trying to build a single-file project, you
> should just use fltk-config directly and it will resolve the
> compilation and linking steps for you:
>
> fltk-config -g --compile my-test-code.cxx
>
>
> >
> > fltk_simple_install_test.o: In function `main':
> > /home/onkar/workspace/./fltk_simple_install_test.c:5: undefined reference=
> to `Fl_Window::Fl_Window(int, int, char const*)'
> > /home/onkar/workspace/./fltk_simple_install_test.c:10: undefined referenc=
> e to `fl_define_FL_SHADOW_LABEL()'
> > /home/onkar/workspace/./fltk_simple_install_test.c:11: undefined referenc=
> e to `Fl_Group::end()'
> > /home/onkar/workspace/./fltk_simple_install_test.c:12: undefined referenc=
> e to `Fl_Window::show(int, char**)'
> > /home/onkar/workspace/./fltk_simple_install_test.c:13: undefined referenc=
> e to `Fl::run()'
> > fltk_simple_install_test.o: In function `Fl_Box':
> > /usr/local/include/FL/Fl_Box.H:57: undefined reference to `Fl_Widget::Fl_=
> Widget(int, int, int, int, char const*)'
> > /usr/local/include/FL/Fl_Box.H:57: undefined reference to `vtable for Fl_=
> Box'
> > collect2: ld returned 1 exit status
> > on...@onkar-laptop:~/workspace$
>
> Well, those symbol names look like fltk-1 symbols, not fltk-2 symbols,
> so it looks like your code is really fltk-1 code after all.
>
> Perhaps that is the problem? You are trying to link fltk-1 code
> against the fltk-2 lib? That will not work. fltk-1.1 and fltk-1.3 have
> the same API, but the fltk-2 API is different and incompatible.
>
>
>
> > other details: I've completed make install for fltk 2.0 with default opti=
> ons.
>
> do the examples from the "test" folder all work? If so, your setup is
> OK and it is just some sort of linker issue to resolve.
>
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk