Building

//Include nana/gui.hpp header file to enable Nana C++ Library
//for the program.
#include <nana/gui.hpp>
#include <nana/gui/widgets/label.hpp>
#include <nana/gui/filebox.hpp>
#include  <nana/gui/msgbox.hpp>
int main()
{
    //All names of Nana is in the namespace nana;
    using namespace nana;
    //Define a form object, class form will create a window
    //when a form instance is created.
    //The new window default visibility is false.
    form fm;
    //Define a label on the fm(form) with a specified area,
    //and set the caption.
    label lb{ fm, rectangle{ 10, 10, 100, 100 } };


    lb.caption("InputBox");
    lb.events().click([&]()
    {
        inputbox::text job("Job","test");
        inputbox inbox( fm, "Select Job to edit");
        if( inbox.show( job ) )
        {
            auto v = job.value();
        }
    });


    fm.show();
    exec();
}

gives

undefined reference to `nana::inputbox::_m_fetch_args

build log:


-------------- Build: Release in test172 (compiler: gcc_v83)---------------

g++.exe -Wall -m64 -fexceptions -O2 -m64 -I..\nana-1.7.2\include -c C:\Users\James\code\test172\main.cpp -o obj\Release\main.o
g++.exe -L..\nana-1.7.2\build\codeblocks -o bin\test172.exe obj\Release\main.o  -m64 -s -static-libstdc++ -static-libgcc -static -m64  -lnana -lgdi32 -lcomdlg32 -lstdc++fs
obj\Release\main.o:main.cpp:(.text+0x180): undefined reference to `nana::inputbox::_m_fetch_args(std::vector<nana::inputbox::abstract_content*, std::allocator<nana::inputbox::abstract_content*> >&)'
collect2.exe: error: ld returned 1 exit status
Building ```` //Include nana/gui.hpp header file to enable Nana C++ Library //for the program. #include <nana/gui.hpp> #include <nana/gui/widgets/label.hpp> #include <nana/gui/filebox.hpp> #include <nana/gui/msgbox.hpp> int main() { //All names of Nana is in the namespace nana; using namespace nana; //Define a form object, class form will create a window //when a form instance is created. //The new window default visibility is false. form fm; //Define a label on the fm(form) with a specified area, //and set the caption. label lb{ fm, rectangle{ 10, 10, 100, 100 } }; lb.caption("InputBox"); lb.events().click([&]() { inputbox::text job("Job","test"); inputbox inbox( fm, "Select Job to edit"); if( inbox.show( job ) ) { auto v = job.value(); } }); fm.show(); exec(); } ```` gives ```` undefined reference to `nana::inputbox::_m_fetch_args ```` build log: ```` -------------- Build: Release in test172 (compiler: gcc_v83)--------------- g++.exe -Wall -m64 -fexceptions -O2 -m64 -I..\nana-1.7.2\include -c C:\Users\James\code\test172\main.cpp -o obj\Release\main.o g++.exe -L..\nana-1.7.2\build\codeblocks -o bin\test172.exe obj\Release\main.o -m64 -s -static-libstdc++ -static-libgcc -static -m64 -lnana -lgdi32 -lcomdlg32 -lstdc++fs obj\Release\main.o:main.cpp:(.text+0x180): undefined reference to `nana::inputbox::_m_fetch_args(std::vector<nana::inputbox::abstract_content*, std::allocator<nana::inputbox::abstract_content*> >&)' collect2.exe: error: ld returned 1 exit status ````

FWIW, the above code compiles fine under g++ 9.1

FWIW, the above code compiles fine under g++ 9.1

Hi, @ravenspoint
This problem occurs because nana is built using -std=c++17 and the program is not built with -std=c++17.

When C++17 is enabled, inputbox uses fold expression for variadic template. Otherwise, it defines the _m_fetch_args functions for the parameters

Hi, @ravenspoint This problem occurs because nana is built using `-std=c++17` and the program is not built with `-std=c++17`. When C++17 is enabled, inputbox uses fold expression for variadic template. Otherwise, it defines the `_m_fetch_args` functions for the parameters
15
views
2
replies
3
followers
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft