I have a simple little program (nominated hello_fltk.cpp), (I use Ubuntu), that I attach below:
#include <FL/Fl.H>
<FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#include <string>
int main(int argc, char **argv) {
const std::string hw_s = "Hello, World!";
Fl_Window *window = new Fl_Window(340, 180);
Fl_Box *box = new Fl_Box(20, 40, 300, 100, hw_s.c_str());
box->box(FL_UP_BOX);
box->labelfont(FL_BOLD + FL_ITALIC);
box->labelsize(36);
box->labeltype(FL_SHADOW_LABEL);
window->end();
window->show(argc, argv);
Fl::run();
return 0;
}
ok, now when I compile it, I write on the terminal : g++ hello_fltk.cpp. The errors that I found are
/tmp/ccfyku2b.o: In function `main': hello_fltk.cpp:(.text+0x70): undefined reference to `Fl_Window::Fl_Window(int, int, char const*)' hello_fltk.cpp:(.text+0xb0): undefined reference to `Fl_Box::Fl_Box(int, int, int, int, char const*)' hello_fltk.cpp:(.text+0xf0): undefined reference to `fl_define_FL_SHADOW_LABEL()' hello_fltk.cpp:(.text+0x106): undefined reference to `Fl_Group::end()' hello_fltk.cpp:(.text+0x11b): undefined reference to `Fl_Window::show(int, char**)' hello_fltk.cpp:(.text+0x120): undefined reference to `Fl::run()' collect2: error: ld returned 1 exit status
So there are undefined references, but I correctly installed all the functions that are reported as not found, so maybe I'm compiling wrong. Can anyone help me fix this linker error? Thanks in advance!