FLTK2(Linux) link Problem



  • Hallo
    ich schaffe es nicht, die FLTK-Lib zu linken.

    #include <fltk/Window.h>
    #include <fltk/Widget.h>
    #include <fltk/run.h>
    
    using namespace fltk;
    
    int main(int argc, char **argv)
    {
        Window *window = new Window(300,180,"HelloWorld(FLTK)");
        window->show(argc,argv);
        return run();
    }
    

    g++ -I/usr/local/include -L/usr/local/lib -o helloWorld -lfltk2 helloWorld.cpp

    /tmp/ccsBv0QG.o: In function `main':
    helloWorld.cpp:(.text+0x43): undefined reference to `fltk::Window::Window(int, int, char const*)'
    helloWorld.cpp:(.text+0x67): undefined reference to `fltk::Window::show(int, char**)'
    helloWorld.cpp:(.text+0x6c): undefined reference to `fltk::run()'
    collect2: ld returned 1 exit status
    


  • Versuch mal mit

    g++ `fltk-config --cxxflags` -o helloWorld.o helloWorld.cpp

    eine Objekt Datei zu erstellen und diese dann mit

    g++ `fltk-config --ldflags` -o helloWorld helloWorld.o

    zu einer ausführbaren Datei zu linken !!!


Anmelden zum Antworten