Unable to Get FLTK Program to Compile

25 views
Skip to first unread message

Wayne Rogers

unread,
May 7, 2026, 6:22:33 PMMay 7
to fltk.general
Extreme frustration.  I am on Ubuntu Linux. I have tried to get the simple FLTK programs to compile on various IDE's (VS Code, Eclipse, CodeLite) with no luck.  I am back to simple compiling on the Terminal, but that wont work. The problem is I continue to get undefined reference errors - the compiler linker is not finding my header and/or linker files.

In the Terminal I use  g++ cs255_lab02_fluid.cpp -i/usr/local/include -l/usr/local/lib -o bin
g++: error: unrecognized command-line option ‘-i/usr/local/include’

With g++ cs255_lab02_fluid.cpp -I /usr/local/include/ -L /usr/local/lib/ -o bin  I get a couple dozen undefined reference errors.

My program:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Button.H>

void cb_btn_animate( Fl_Widget* btn, void* userdata );

int main()
{
    Fl_Double_Window window = Fl_Double_Window( 283, 110 );
    Fl_Output output = Fl_Output( 30, 15, 100, 25 );
    Fl_Button button = Fl_Button( 40, 60, 75, 25, "Animate" );
    button.callback( ( Fl_Callback* ) cb_btn_animate, &output );

    window.end();
    window.resizable( window );
    window.show();

    return Fl::run();
}

void cb_btn_animate( Fl_Widget* btn, void* userdata )
{
    Fl_Output& output = *static_cast< Fl_Output* >( userdata );
    output.value( "Hello" );
}

HELP!!!   My FLTK library files are in /usr/local/lib  and headers are in /usr/local/include/FL

imm

unread,
May 7, 2026, 6:36:38 PMMay 7
to General FLTK
On Thu, 7 May 2026, 23:22 Wayne Rogers wrote:
In the Terminal I use  g++ cs255_lab02_fluid.cpp -i/usr/local/include -l/usr/local/lib -o bin
g++: error: unrecognized command-line option ‘-i/usr/local/include’


Needs to be a capital -I, not lower case -i in the include command.


With g++ cs255_lab02_fluid.cpp -I /usr/local/include/ -L /usr/local/lib/ -o bin  I get a couple dozen undefined reference errors.

You haven't told the compiler/linker which libs to link against.
You'll need at least -lfltk (that's a lower case L, not a capital I there!) and probably a fair few others.

Do you have fltk-config available? If so use that, it'll know what to do and what libs to link with.



My program:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Button.H>

void cb_btn_animate( Fl_Widget* btn, void* userdata );

int main()
{
    Fl_Double_Window window = Fl_Double_Window( 283, 110 );
    Fl_Output output = Fl_Output( 30, 15, 100, 25 );
    Fl_Button button = Fl_Button( 40, 60, 75, 25, "Animate" );
    button.callback( ( Fl_Callback* ) cb_btn_animate, &output );

    window.end();
    window.resizable( window );
    window.show();

    return Fl::run();
}

void cb_btn_animate( Fl_Widget* btn, void* userdata )
{
    Fl_Output& output = *static_cast< Fl_Output* >( userdata );
    output.value( "Hello" );
}

HELP!!!   My FLTK library files are in /usr/local/lib  and headers are in /usr/local/include/FL

--
Ian
From my Fairphone FP6

Gonzalo Garramuno

unread,
May 7, 2026, 8:33:54 PMMay 7
to fltkg...@googlegroups.com
For simple programs on Unix you can use:

fltk-config --compile main.cpp --use-gl

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/fltkgeneral/CAGFM6dYWC1BxDBT%2Bt1GgS0sMD9%2B1_yKfY7-GABoEgYGMAU6Sww%40mail.gmail.com.

Wayne Rogers

unread,
May 8, 2026, 9:59:00 AMMay 8
to fltk.general
Thanks.  That worked.
Reply all
Reply to author
Forward
0 new messages