On 06.11.2010, at 07:22, eric wrote: > Dear Fltk programers: > > I find a lot fl_graphics_driver in "fl_draw.H" but not in "fl_draw.cxx" > my current link version of fltk used to compile my chapter.12.3 program(of > book of Mr. Bjarne Stroustrup-"Programming-Principle and practice using c++" > 4th Ed.) is 1.3.x > (is that right one?)
As noted earlier, the book uses fltk 1.1 - thus, for best compatibility you'd better use 1.1.10, but 1.3.x might work as well (there are only very few API changes, but these can matter). > I am in Ubuntu10.04,gcc/g++4.4.3 > > Is I missing any header files on my(or Mr. Stroustrup's) Graph.h or > Graph.cpp? > --------------------------------------------------------- > r...@eric-laptop:/home/eric/BStrou/usingC++4/code/Chapter12# make > g++ -o Graph Graph.o -lstdc++ -lbookgui -lfltk -lfltk_images -lX11 -ljpeg > /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o: In function > `_start': > (.text+0x18): undefined reference to `main' I don't know why you don't have `main'. You probably missed an input file. OTOH, the shown compile/link line appears to be wrong. You must sort libraries according to their dependencies, otherwise you'll get undefined references: -lfltk_images must precede -lfltk -lbookgui probably should preceed -lstdc++ ... unless you're using shared libraries, where this might not matter. > Graph.o: In function `Graph_lib::Shape::draw() const': > Graph.cpp:(.text+0xac): undefined reference to `fl_graphics_driver' > Graph.cpp:(.text+0xc6): undefined reference to `fl_graphics_driver' > Graph.cpp:(.text+0xf1): undefined reference to `fl_graphics_driver' > Graph.cpp:(.text+0x102): undefined reference to `fl_graphics_driver' > Graph.o: In function `Graph_lib::Text::draw_lines() const': > Graph.cpp:(.text+0xd97): undefined reference to `fl_graphics_driver' > Graph.o:Graph.cpp:(.text+0xe0e): more undefined references to > `fl_graphics_driver' follow > Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[vtable for > Graph_lib::Bad_image]+0x14): undefined reference to > `Fl_Image::color_average(unsigned int, float)' > collect2: ld returned 1 exit status > make: *** [Graph] Error 1 The undefined reference to Fl_Image::color_average() seems to indicate the first wrong library order shown above. Another reason why you're missing fl_graphics_driver *might* be that you're mixing fltk 1.1 and fltk 1.3. If you really want to use fltk 1.3 and have fltk 1.1 *installed* somewhere, then you must deinstall fltk 1.1 to be sure that you don't mix libraries (or use a non-standard install prefix for both). If you installed the ubuntu FLTK version, deinstall the package before installing FLTK 1.3. Albrecht _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

