みんな。私はBjarneStroustrupの「C++を使用したプログラミングの原則と実践」の本を学んでいます。Ubuntu12.10でNetbeans7.3を使用しています。この本の第12章で、この単純なグラフィックプログラムを作成して実行したいと思います。プログラムは次のようになります。
#include "Simple_window.h" // get access to our window library
#include "Graph.h" // get access to our graphics library facilities
int main()
{
using namespace Graph_lib; // our graphics facilities are in Graph_lib
Point tl(100,100); // to become top left corner of window
Simple_window win(tl,600,400,"Canvas"); // make a simple window
Polygon poly; // make a shape (a polygon)
poly.add(Point(300,200)); // add a point
poly.add(Point(350,100)); // add another point
poly.add(Point(400,200)); // add a third point
poly.set_color(Color::red); // adjust properties of poly
win.attach (poly); // connect poly to the window
win.wait_for_button(); // give control to the display engine
}
このプログラムを2日間作成できません。http://www.stroustrup.com/Programming/Graphics/にあるすべてのグラフィックライブラリをプロジェクトに追加しました。また、FLTK-1.1.10を正常にインストールし、Netbeansに構成しました。FLTKに関するすべてのプログラムはNetbeansで非常にうまく動作します。しかし、上記のプログラムをビルドして実行すると、多くのエラーが発生します。エラーは次のようになります:「...への未定義の参照」。Netbeansでこの問題を解決するにはどうすればよいですか?
次のようなエラーが発生します。
g ++ -o dist / Debug / GNU-Linux-x86 / cppapplication_3 build / Debug / GNU-Linux-x86 / GUI.o build / Debug / GNU-Linux-x86 / Graph.o build / Debug / GNU-Linux-x86 / Simple_window.o build / Debug / GNU-Linux-x86 / Window.o build / Debug / GNU-Linux-x86 / main.o -L ../../ Downloads / fltk-1.1.10 / lib -lfltk -lfltk_forms -lfltk_gl -lfltk_images -lfltk_jpeg ../../Downloads/fltk-1.1.10/lib/libfltk.a(Fl_get_system_colors.o):関数getsyscolor(char const*, char const*, char const*, char const*, void (*)(unsigned char, unsigned char, unsigned char))':
Fl_get_system_colors.cxx:(.text+0x17): undefined reference to
XGetDefault'Fl_get_system_colors.cxx:(。text + 0x38):XParseColor'
../../Downloads/fltk-1.1.10/lib/libfltk.a(Fl_get_system_colors.o): In function
fl_parse_colorへの未定義の参照(char const *、unsigned char&、unsigned char&、unsigned char&)':Fl_get_system_colors.cxx:(。text + 0x2cd):`XParseColor'への未定義の参照......。