我正在使用C来完成Stroustrup的原理和实践.我试图让以下程序编译.
#include <FL/Fl.H> #include <FL/Fl_Box.H> #include <Fl/Fl_Window.H> int main() { Fl_Window window(200,200,"Window title"); Fl_Box Box(0,"Hey,I mean,Hello,World!"); window.show(); return Fl::run(); }
我尝试使用g -std = c 11 trial.cpp -o试验进行编译,但之后又抛出了以下错误
/tmp/ccaLRS7L.o: In function `main': trial.cpp:(.text+0x26): undefined reference to `Fl_Window::Fl_Window(int,int,char const*)' trial.cpp:(.text+0x50): undefined reference to `Fl_Box::Fl_Box(int,char const*)' trial.cpp:(.text+0x5f): undefined reference to `Fl_Window::show()' trial.cpp:(.text+0x64): undefined reference to `Fl::run()' trial.cpp:(.text+0x84): undefined reference to `Fl_Window::~Fl_Window()' trial.cpp:(.text+0xae): undefined reference to `Fl_Window::~Fl_Window()' /tmp/ccaLRS7L.o: In function `Fl_Box::~Fl_Box()': trial.cpp:(.text._ZN6Fl_BoxD2Ev[_ZN6Fl_BoxD5Ev]+0x13): undefined reference to `vtable for Fl_Box' trial.cpp:(.text._ZN6Fl_BoxD2Ev[_ZN6Fl_BoxD5Ev]+0x1f): undefined reference to `Fl_Widget::~Fl_Widget()' collect2: error: ld returned 1 exit status
我从终端安装了FLTK 1.3版.我在我的电脑上运行Linux mint 17.我该如何编译这段代码?