I am trying to get the graphics examples to work from Stroustrup's Principles and Practices ...C++, to no avail (yet). I have installed the fltk stuff, and know that is working fine as I managed to get a window to display using with a program suggested in the appendix of his book:
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Window.H>
int main(){
Fl_Window window(200,200, "title here");
Fl_Box box(0,0,200,200,"Hey, hello wrld");
window.show();
return Fl::run();
}
However, trying my own using his Simple_window.h (can be found on his site) gives "reference to ‘Window’ is ambiguous", since it's already at usr/include/X11/X.h . So I tried specifying the namespace to the relevant one:
struct Simple_window : Graph_lib::Window { //Changed Window to inc. namespace
Simple_window(Point xy, int w, int h, const string& title );
bool wait_for_button(); // simple event loop
.
.
.
But this gives me a bunch more errors I don't understand:
$ clear; g++ -Wno-deprecated window.cpp -o holz
/tmp/ccIFivNg.o: In function `main':
window.cpp:(.text+0x64): undefined reference to `Simple_window::Simple_window(Point, int, int, String const&)'
/tmp/ccIFivNg.o: In function `Graph_lib::Window::~Window()':
window.cpp:(.text._ZN9Graph_lib6WindowD2Ev[_ZN9Graph_lib6WindowD5Ev]+0x14): undefined reference to `vtable for Graph_lib::Window'
etc.
I feel mastering graphics is going to be a long and rocky road -_-