我目前正在通过 Stroustrup 的《编程:使用 C++ 的原则和实践》一书学习 C++,目前在第 12 章。我现在一直在尝试让 FLTK 使用特定的标头工作。
我已经用 MacPorts 安装了 FLTK。当我尝试编译包含 Simple_window.h 的代码时,出现以下错误:
bash-3.2# fltk-config --compile main.cpp
/usr/bin/g++-4.2 -arch i386 -I/opt/local/include -pipe -arch i386 -arch i386
-D_THREAD_SAFE -D_REENTRANT -o main main.cpp -arch i386 -arch i386
/opt/local/lib/libfltk.a -lpthread -framework Carbon -framework
ApplicationServices
Undefined symbols:
"vtable for Graph_lib::Window", referenced from:
__ZTVN9Graph_lib6WindowE$non_lazy_ptr in cc1oxcSA.o
(maybe you meant: __ZTVN9Graph_lib6WindowE$non_lazy_ptr)
"vtable for Graph_lib::Button", referenced from:
__ZTVN9Graph_lib6ButtonE$non_lazy_ptr in cc1oxcSA.o
(maybe you meant: __ZTVN9Graph_lib6ButtonE$non_lazy_ptr)
"Simple_window::Simple_window(Point, int, int, String const&)", referenced from:
_main in cc1oxcSA.o
"Graph_lib::Window::draw()", referenced from:
vtable for Simple_windowin cc1oxcSA.o
"typeinfo for Graph_lib::Window", referenced from:
typeinfo for Simple_windowin cc1oxcSA.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
我不知道这是什么意思。我在这里阅读了答案(SO)。我创建了 .o 文件。我正在尝试使用 fltk-config 在 Mac OS 上编译它。