follow collect2: error: ld returned 1 exit status on c++

  c++, codeblocks, g++, nana, ubuntu-20.04

Im using ubuntu 20.04 and code::blocks to program a simple window on nana and I compiled it in g++ (using ubuntu terminal) to test it and its giving me a butt ton of errors and by the way my file is called Window.cpp
this is the one at the bottom because it would take forever to type them all:

/usr/bin/ld: /tmp/cccfeIoj.o:Window.cpp:(.text._ZN4nana11basic_eventINS_9arg_focusEED2Ev[_ZN4nana11basic_eventINS_9arg_focusEED5Ev]+0x2c): more undefined references to 'nana::detail::event_base::~event_base()' follow collect2: error: ld returned 1 exit status

this is what i typed to compile it:

g++ -o Window Window.cpp -w -p -I/nana/include

this is my code:

#include <nana/gui.hpp>
#include <nana/gui/widgets/label.hpp>
#include <nana/gui/widgets/button.hpp>

int main()
{
    using namespace nana;

    //Define a form.
    form fm;

    //Define a label and display a text.
    label lab{fm, "Hello, <bold blue size=16>Nana C++ Library</>"};
    lab.format(true);

    //Define a button and answer the click event.
    button btn{fm, "Quit"};
    btn.events().click([&fm]{
        fm.close();
    });

    //Layout management
    fm.div("vert <><<><weight=80% text><>><><weight=24<><button><>><>");
    fm["text"]<<lab;
    fm["button"] << btn;
    fm.collocate();
    
    //Show the form
    fm.show();

    //Start to event loop process, it blocks until the form is closed.
    exec();

    //Show that it didn't break
    return 0;

}

Source: Windows Questions C++

LEAVE A COMMENT