问题描述
我有一个简单的小程序(命名为 hello_fltk.cpp),(我使用 Ubuntu),我附在下面:
#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;
}
好的,现在当我编译它时,我在终端上写:g++ hello_fltk.cpp。我发现的错误是
/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,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
所以有未定义的引用,但我正确安装了所有报告为未找到的函数,所以也许我编译错误。谁能帮我解决这个链接器错误? 提前致谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)