this group is moderated, at least for first-time posters. Please
wait some time for your post to appear. Thanks.
A moderator may enable you to post w/o moderation at some time...
On 10/26/25 15:13 'Klaus Rudolph' via
fltk.general wrote:
I try to build the following prog:
For your next questions, please post the full program with all
headers so we can compile and test. At a first glance I didn't see
any error, but ...
class MyWin: public Fl_Window
{
public:
MyWin( int x, int y, int w, int h, const char* title = 0
):
Fl_Window(x,y,w,h,"Hallo Welt!")
{
}
Before you can draw text you need to set a font (at least once, but
it is recommended to do it always immediately before drawing text to
guarantee consistent behavior (otherwise any previously set font
might be used). Add the following line before fl_draw to prevent the
segfault:
fl_font(FL_COURIER, 20);
Of course any other font would do as well.
fl_draw( "Hallo world", 10,20);
}
};
int main() {
auto display = new MyWin(1,1,900, 600, "Test");
display->color(FL_RED);
display->show();
Fl::run();
}
I compiled it with:
g++ -g \
`/home/krud/external_repos/fltk-1.4.4/myinstall/bin/fltk-config
--cflags` \
main.cpp \
`/home/krud/external_repos/fltk-1.4.4/myinstall/bin/fltk-config
--ldflags` \
-o go
I got:
Program received signal SIGSEGV, Segmentation fault.
Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.