LoginSignup
1
1

More than 5 years have passed since last update.

経緯

FLTKを使わなければならない課題が出題されたので、なんとかMacで使う方法を検討した。

Homebrewを使う

HomebrewにはFLTKのバージョン1.3.2が収録されているので、最初はこれを導入していた。ところがこのFLTK1.3.2を用いて次のようなプログラムをコンパイルするとセグメンテーションフォルトで死ぬ。

#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Window.H>

int main(int argc, char **argv) {
    Fl_Window *window = new Fl_Window(300,180);
    Fl_Box *box = new Fl_Box(20,40,260,100,"Hello World!");

    box->box(FL_UP_BOX);
    box->labelsize(36);
    box->labelfont(FL_BOLD+FL_ITALIC);
    box->labeltype(FL_SHADOW_LABEL);

    window->end();
    window->show(argc, argv);

    return Fl::run();
}

これはFLTKのHello World的なプログラムなので、これがコンパイル出来ないようでは話にならない。

解決方法

FLTKのsnapshot r9998を導入したら解決したように思われる。1.3.2とはコンパイルの方法が違うので、注意しなければならない。展開したフォルダにあるREADME.OSX.txtを読めば分かるが、automakeを用いなければならない。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1