dear fltk progammer by c++ (on linux/ubuntu):
after i install every package and ready to go(compile) some simple fltk
program from Mr. Stroustrup "Programming-Principle and practice usingC++" 4th
ed., chapter 12's first example program(chapter.12.3.cpp
copied from his website,
http://www.stroustrup.com/Programming/
)
I get a lot compile errors, which is really out of novice as me to figure out.
-------------------------------------------------------------
r...@eric-laptop:/home/eric/BStrou/usingC++4/code/Chapter12#
/home/eric/Dfltk/fltk-1.1.10/fltk-config --compile chapter.12.3.cpp
g++ -I/home/eric/Dfltk/fltk-1.1.10 -I/home/eric/Dfltk/fltk-1.1.10/png
-I/home/eric/Dfltk/fltk-1.1.10/jpeg -o chapter.12.3 chapter.12.3.cpp
/home/eric/Dfltk/fltk-1.1.10/lib/libfltk.a -ldl -lm -lXext -lX11
In file included from /usr/include/c++/4.4/ext/hash_map:60,
from std_lib_facilities.h:34,
from Graph.h:13,
from GUI.h:11,
from Simple_window.h:10,
from chapter.12.3.cpp:7:
/usr/include/c++/4.4/backward/backward_warning.h:28:2: warning: #warning This
file includes at least one deprecated or antiquated header which may be removed
without further notice at a future date. Please use a non-deprecated interface
with equivalent functionality instead. For a listing of replacement headers and
interfaces, consult the file backward_warning.h. To disable this warning use
-Wno-deprecated.
/tmp/cchyNVIk.o: In function `main':
chapter.12.3.cpp:(.text+0x7d): undefined reference to
`Simple_window::Simple_window(Point, int, int, String const&)'
chapter.12.3.cpp:(.text+0x100): undefined reference to
`Graph_lib::Polygon::add(Point)'
chapter.12.3.cpp:(.text+0x144): undefined reference to
`Graph_lib::Polygon::add(Point)'
chapter.12.3.cpp:(.text+0x188): undefined reference to
`Graph_lib::Polygon::add(Point)'
chapter.12.3.cpp:(.text+0x1e7): undefined reference to
`Simple_window::wait_for_button()'
/tmp/cchyNVIk.o: In function `Graph_lib::Window::~Window()':
chapter.12.3.cpp:(.text._ZN9Graph_lib6WindowD2Ev[Graph_lib::Window::~Window()]+0xd):
undefined reference to `vtable for Graph_lib::Window'
/tmp/cchyNVIk.o: In function `Graph_lib::Shape::~Shape()':
chapter.12.3.cpp:(.text._ZN9Graph_lib5ShapeD2Ev[Graph_lib::Shape::~Shape()]+0xb):
undefined reference to `vtable for Graph_lib::Shape'
/tmp/cchyNVIk.o: In function `Graph_lib::Open_polyline::Open_polyline()':
chapter.12.3.cpp:(.text._ZN9Graph_lib13Open_polylineC2Ev[Graph_lib::Open_polyline::Open_polyline()]+0xd):
undefined reference to `Graph_lib::Shape::Shape()'
chapter.12.3.cpp:(.text._ZN9Graph_lib13Open_polylineC2Ev[Graph_lib::Open_polyline::Open_polyline()]+0x16):
undefined reference to `vtable for Graph_lib::Open_polyline'
/tmp/cchyNVIk.o: In function `Graph_lib::Open_polyline::~Open_polyline()':
chapter.12.3.cpp:(.text._ZN9Graph_lib13Open_polylineD2Ev[Graph_lib::Open_polyline::~Open_polyline()]+0xb):
undefined reference to `vtable for Graph_lib::Open_polyline'
/tmp/cchyNVIk.o: In function `Graph_lib::Button::~Button()':
chapter.12.3.cpp:(.text._ZN9Graph_lib6ButtonD1Ev[Graph_lib::Button::~Button()]+0xb):
undefined reference to `vtable for Graph_lib::Button'
/tmp/cchyNVIk.o: In function `Graph_lib::Closed_polyline::Closed_polyline()':
chapter.12.3.cpp:(.text._ZN9Graph_lib15Closed_polylineC2Ev[Graph_lib::Closed_polyline::Closed_polyline()]+0x16):
undefined reference to `vtable for Graph_lib::Closed_polyline'
/tmp/cchyNVIk.o: In function `Graph_lib::Closed_polyline::~Closed_polyline()':
chapter.12.3.cpp:(.text._ZN9Graph_lib15Closed_polylineD2Ev[Graph_lib::Closed_polyline::~Closed_polyline()]+0xb):
undefined reference to `vtable for Graph_lib::Closed_polyline'
/tmp/cchyNVIk.o: In function `Graph_lib::Polygon::Polygon()':
chapter.12.3.cpp:(.text._ZN9Graph_lib7PolygonC1Ev[Graph_lib::Polygon::Polygon()]+0x16):
undefined reference to `vtable for Graph_lib::Polygon'
/tmp/cchyNVIk.o: In function `Graph_lib::Polygon::~Polygon()':
chapter.12.3.cpp:(.text._ZN9Graph_lib7PolygonD1Ev[Graph_lib::Polygon::~Polygon()]+0xb):
undefined reference to `vtable for Graph_lib::Polygon'
/tmp/cchyNVIk.o:(.rodata._ZTV13Simple_window[vtable for Simple_window]+0x10):
undefined reference to `Graph_lib::Window::draw()'
/tmp/cchyNVIk.o:(.rodata._ZTI13Simple_window[typeinfo for Simple_window]+0x8):
undefined reference to `typeinfo for Graph_lib::Window'
collect2: ld returned 1 exit status
r...@eric-laptop:/home/eric/BStrou/usingC++4/code/Chapter12# g++
-Wno-deprecated chapter.12.3.cpp Simple_window.cpp Graph.cpp GUI.cpp Window.cpp
-lfltk -lfltk_images
Window.cpp:15: error: prototype for âGraph_lib::Window::Window(int, int,
const String&)â does not match any in class âGraph_lib::Windowâ
Window.h:26: error: candidates are: Graph_lib::Window::Window(const
Graph_lib::Window&)
Window.h:31: error: Graph_lib::Window::Window(Point, int, int,
const std::string&)
Window.h:29: error: Graph_lib::Window::Window(int, int, const
std::string&)
Window.cpp:23: error: prototype for âGraph_lib::Window::Window(Point, int,
int, const String&)â does not match any in class âGraph_lib::Windowâ
Window.h:26: error: candidates are: Graph_lib::Window::Window(const
Graph_lib::Window&)
Window.h:31: error: Graph_lib::Window::Window(Point, int, int,
const std::string&)
Window.h:29: error: Graph_lib::Window::Window(int, int, const
std::string&)
r...@eric-laptop:/home/eric/BStrou/usingC++4/code/Chapter12#
-----------------------------------------
this is chapter.12.3.cpp
-------------------------
//
// This is example code from Chapter 12.3 "A first example" of
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//
#include "Simple_window.h" // get access to our window library
#include "Graph.h" // get access to our graphics library facilities
//------------------------------------------------------------------------------
int main()
{
using namespace Graph_lib; // our graphics facilities are in Graph_lib
Point tl(100,100); // to become top left corner of window
Simple_window win(tl,600,400,"Canvas"); // make a simple window
Polygon poly; // make a shape (a polygon)
poly.add(Point(300,200)); // add a point
poly.add(Point(350,100)); // add another point
poly.add(Point(400,200)); // add a third point
poly.set_color(Color::red); // adjust properties of poly
win.attach (poly); // connect poly to the window
win.wait_for_button(); // give control to the display engine
}
//------------------------------------------------------------------------------
this is my directory used to compile that program
----------------------------------------------
r...@eric-laptop:/home/eric/BStrou/usingC++4/code/Chapter12# ls
build.bat chapter.12.7.2.cpp chapter.12.7.6-1.cpp
chapter.12.7.8-2.cpp GUI.cpp index.html.2 MatrixIO.h
std_lib_facilities.h
ch12try1.cpp chapter.12.7.3-1.cpp chapter.12.7.6-2.cpp
chapter.12.7.9-1.cpp GUI.h index.html.3 Point.h
std_lib_facilities.h.1
chapter.12.3.cpp chapter.12.7.3-2.cpp chapter.12.7.6.cpp
chapter.12.7.9-2.cpp image.jpg Makefile Simple_window.cpp Window.cpp
chapter.12.7.10.cpp chapter.12.7.4.cpp chapter.12.7.7.cpp Graph.cpp
index.html Makefile.1 Simple_window.h Window.h
chapter.12.7.1.cpp chapter.12.7.5.cpp chapter.12.7.8-1.cpp Graph.h
index.html.1 Matrix.h snow_cpp.gif
r...@eric-laptop:/home/eric/BStrou/usingC++4/code/Chapter12#
-----------------------------------------------
plz help
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk