On 8 July 2010 23:01, Onkar Raut <[email protected]> wrote:

>  I'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 corresponding 
> 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/local/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 reference to 
> `fl_define_FL_SHADOW_LABEL()'
> /home/onkar/workspace/./fltk_simple_install_test.c:11: undefined reference to 
> `Fl_Group::end()'
> /home/onkar/workspace/./fltk_simple_install_test.c:12: undefined reference to 
> `Fl_Window::show(int, char**)'
> /home/onkar/workspace/./fltk_simple_install_test.c:13: undefined reference 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 options.

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

Reply via email to