FLTK logo

[fltk.general] I just installed FLTK on Linux but I have a compile error

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

I just installed FLTK on Linux but I have a compile error ken williams Oct 21, 2020  
 
I just installed FLTK library on Linux with the standard commands: cmake .. / make / sudo make install

My understanding is that "make install" moved the library to /usr/local/include. And I found the folder there:

    [ken@Lnx include]$ pwd
    /usr/local/include
    [ken@Lnx include]$ ls
    FL
Now I want to run the test from "Programming Principle and Practice" with the code:

    #include <FL/Fl.h>
    #include <FL/Fl_Box.h>
    #include <FL/Fl_Window.h>
    int main()
    {
        Fl_Window window(200, 200, "Window title");
        Fl_Box box(0, 0, 200, 200, "Hey, I mean, Hello, World!");
        window.show();
        return Fl::run();
    }

Initially I had include errors, but then I noticed the files in the FL folder have .H and not .h extensions.
They disappeared after changing that in the code .

But now I have this compile error:

    ken@Lnx fltk_test]$ g++ fltk_test.cpp
    /usr/bin/ld: /tmp/ccJWfQR3.o: warning: relocation against `_ZTV6Fl_Box' in read-only section `.text._ZN6Fl_BoxD2Ev[_ZN6Fl_BoxD5Ev]'
    /usr/bin/ld: /tmp/ccJWfQR3.o: in function `main':
    fltk_test.cpp:(.text+0x37): undefined reference to `Fl_Window::Fl_Window(int, int, char const*)'
    /usr/bin/ld: fltk_test.cpp:(.text+0x62): undefined reference to `Fl_Box::Fl_Box(int, int, int, int, char const*)'
    /usr/bin/ld: fltk_test.cpp:(.text+0x71): undefined reference to `Fl_Window::show()'
    /usr/bin/ld: fltk_test.cpp:(.text+0x76): undefined reference to `Fl::run()'
    /usr/bin/ld: fltk_test.cpp:(.text+0x97): undefined reference to `Fl_Window::~Fl_Window()'
    /usr/bin/ld: fltk_test.cpp:(.text+0xd0): undefined reference to `Fl_Window::~Fl_Window()'
    /usr/bin/ld: /tmp/ccJWfQR3.o: in function `Fl_Box::~Fl_Box()':
    fltk_test.cpp:(.text._ZN6Fl_BoxD2Ev[_ZN6Fl_BoxD5Ev]+0xf): undefined reference to `vtable for Fl_Box'
    /usr/bin/ld: fltk_test.cpp:(.text._ZN6Fl_BoxD2Ev[_ZN6Fl_BoxD5Ev]+0x22): undefined reference to `Fl_Widget::~Fl_Widget()'
    /usr/bin/ld: warning: creating DT_TEXTREL in a PIE
    collect2: error: ld returned 1 exit status


I use Visual Studio Code Insiders and I configured "settings.json" to have these default settings that I wanted to make visible the library to future projects:

"C_Cpp.default.compilerPath": "/usr/bin/gcc",
"C_Cpp.default.includePath": ["/usr/local/include/"],

I configured "c_cpp_properties.json" with the same settings, that overwrites the default settings from "settings.json". 
But I get the same errors.

What else can I do? Thanks for your reply!



--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/3a31beab-4a3c-4361-9fdf-641ce93553d4n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.