Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm reading and learning Bjarne Stroustrup's "Programming principles and practice using C++". I want to use graphics libraries from chapter 12-16 in Netbeans 7.3.

I have already added header files (Simple_window.h, Graph.h and others) and source files (Graph.cpp and others). I also installed fltk-1.1.10 and configured it to Netbeans.

But I can't build "First example" program in Chapter 12. When I write Simple_window and Polygon functions, errors occur while compiling. Errors are something like this: Undefined reference to <some functions or class> The program is like this.

#include "Simple_window.h"  
#include "Graph.h"  
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
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.