In general, I need to build v1.7.2 with -std=c++17, otherwise i have problems with std::filesystem.

( Actually v1.7.2 is still broken, so I am using v1.7.2hotfix )

However, this gives me problems using folderbox.

Code:

#include <nana/gui/filebox.hpp>
#include <iostream>

int main()
{
    nana::folderbox picker;

    auto paths = picker.show();
    if(paths.empty())
    {
        std::cout<<"Cancelled"<<std::endl;
    }
    else
    {
        for(auto & p : paths)
            std::cout << "Selected folder:" << p << std::endl;
    }
}

builds fine without C++17

-------------- Build: Release in testfolderbox (compiler: gcc v8.3)---------------

g++.exe -Wall -fexceptions -O2 -m64 -IC:\Users\James\code\nana1-7-2hotfix\include -c C:\Users\James\code\testfolderbox\main.cpp -o obj\Release\main.o
g++.exe -LC:\Users\James\code\nana1-7-2hotfix\build\codeblocks -o ..\bin\testfolderbox.exe obj\Release\main.o  -static-libstdc++ -static-libgcc -static -m64  -lnana -lstdc++fs -lgdi32 -lcomdlg32 -lws2_32 -lwsock32
Output file is ..\bin\testfolderbox.exe with size 5.92 MB

but fails with c++17

-------------- Build: Release in testfolderbox (compiler: gcc v8.3)---------------


g++.exe -Wall -fexceptions -std=c++17 -O2 -m64 -IC:\Users\James\code\nana1-7-2hotfix\include -c C:\Users\James\code\testfolderbox\main.cpp -o obj\Release\main.o
g++.exe -LC:\Users\James\code\nana1-7-2hotfix\build\codeblocks -o ..\bin\testfolderbox.exe obj\Release\main.o  -static-libstdc++ -static-libgcc -static -m64  -lnana -lstdc++fs -lgdi32 -lcomdlg32 -lws2_32 -lwsock32
obj\Release\main.o:main.cpp:(.text.startup+0x97): undefined reference to `nana::folderbox::folderbox(nana::detail::basic_window*, std::filesystem::__cxx11::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
`

So now I am stuck!

In general, I need to build v1.7.2 with -std=c++17, otherwise i have problems with std::filesystem. ( Actually v1.7.2 is still broken, so I am using v1.7.2hotfix ) However, this gives me problems using folderbox. Code: ```` #include <nana/gui/filebox.hpp> #include <iostream> int main() { nana::folderbox picker; auto paths = picker.show(); if(paths.empty()) { std::cout<<"Cancelled"<<std::endl; } else { for(auto & p : paths) std::cout << "Selected folder:" << p << std::endl; } } ```` builds fine without C++17 ```` -------------- Build: Release in testfolderbox (compiler: gcc v8.3)--------------- g++.exe -Wall -fexceptions -O2 -m64 -IC:\Users\James\code\nana1-7-2hotfix\include -c C:\Users\James\code\testfolderbox\main.cpp -o obj\Release\main.o g++.exe -LC:\Users\James\code\nana1-7-2hotfix\build\codeblocks -o ..\bin\testfolderbox.exe obj\Release\main.o -static-libstdc++ -static-libgcc -static -m64 -lnana -lstdc++fs -lgdi32 -lcomdlg32 -lws2_32 -lwsock32 Output file is ..\bin\testfolderbox.exe with size 5.92 MB ```` but fails with c++17 ``` -------------- Build: Release in testfolderbox (compiler: gcc v8.3)--------------- g++.exe -Wall -fexceptions -std=c++17 -O2 -m64 -IC:\Users\James\code\nana1-7-2hotfix\include -c C:\Users\James\code\testfolderbox\main.cpp -o obj\Release\main.o g++.exe -LC:\Users\James\code\nana1-7-2hotfix\build\codeblocks -o ..\bin\testfolderbox.exe obj\Release\main.o -static-libstdc++ -static-libgcc -static -m64 -lnana -lstdc++fs -lgdi32 -lcomdlg32 -lws2_32 -lwsock32 obj\Release\main.o:main.cpp:(.text.startup+0x97): undefined reference to `nana::folderbox::folderbox(nana::detail::basic_window*, std::filesystem::__cxx11::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' ```` So now I am stuck!

Well, with CodeBlocks 17.12 and gcc 9.2, your code is compiled fine... with c++17 enabled... (without hotfix)

g++.exe -Wall -fexceptions -O2 -std=c++1z -IC:\MinGW\include -c "F:\Programming\CodeBlocks\Nana Projects\Test\main.cpp" -o obj\Release\main.o
g++.exe -o bin\Release\Test.exe obj\Release\main.o -s -static-libstdc++ -static-libgcc -lnana -ljpeg -lpng -lz -lgdi32 -lcomdlg32
Output file is bin\Release\Test.exe with size 2.36 MB
Process terminated with status 0 (0 minute(s), 3 second(s))
0 error(s), 0 warning(s) (0 minute(s), 3 second(s))

Well, with CodeBlocks 17.12 and gcc 9.2, your code is compiled fine... with c++17 enabled... (without hotfix) > g++.exe -Wall -fexceptions -O2 -std=c++1z -IC:\MinGW\include -c "F:\Programming\CodeBlocks\Nana Projects\Test\main.cpp" -o obj\Release\main.o g++.exe -o bin\Release\Test.exe obj\Release\main.o -s -static-libstdc++ -static-libgcc -lnana -ljpeg -lpng -lz -lgdi32 -lcomdlg32 Output file is bin\Release\Test.exe with size 2.36 MB Process terminated with status 0 (0 minute(s), 3 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 3 second(s))
edited Sep 11 at 9:55 pm

Without hotfix, several other things are broken. Your "fix" is not going to work for me.

Without hotfix, several other things are broken. Your "fix" is not going to work for me.

Just curious.... what's the hotfix is about? So far, I am doing fine without the hotfix... Also, if you are going to go c++17 path, then gcc 9.x is the way to go... gcc 8.x only partially supported...

Just curious.... what's the hotfix is about? So far, I am doing fine without the hotfix... Also, if you are going to go c++17 path, then gcc 9.x is the way to go... gcc 8.x only partially supported...

I have installed g++ v9.2 Same problem.

C:\msys64-g92\mingw64\bin>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-9.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/includ
e --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortr
an,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable
-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable
-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release
--disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libicon
v --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion=
'Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 9.2.0 (Rev2, Built by MSYS2 project)
-------------- Build: Release in testfolderbox (compiler: g92)---------------

g++.exe -Wall -fexceptions -std=c++17 -m64 -O2 -IC:\Users\James\code\nana1-7-2hotfix\include -c C:\Users\James\code\testfolderbox\main.cpp -o obj\Release\main.o
g++.exe -LC:\Users\James\code\nana1-7-2hotfix\build\codeblocks -o ..\bin\testfolderbox.exe obj\Release\main.o  -static-libstdc++ -static-libgcc -static -m64  -lnana -lstdc++fs -lgdi32 -lcomdlg32 -lws2_32 -lwsock32
C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: obj\Release\main.o:main.cpp:(.text.startup+0x82): undefined reference to `nana::folderbox::folderbox(nana::detail::basic_window*, std::filesystem::__cxx11::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
I have installed g++ v9.2 Same problem. ```` C:\msys64-g92\mingw64\bin>g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-9.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/includ e --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortr an,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable -fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable -libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libicon v --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion= 'Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld Thread model: posix gcc version 9.2.0 (Rev2, Built by MSYS2 project) ```` ```` -------------- Build: Release in testfolderbox (compiler: g92)--------------- g++.exe -Wall -fexceptions -std=c++17 -m64 -O2 -IC:\Users\James\code\nana1-7-2hotfix\include -c C:\Users\James\code\testfolderbox\main.cpp -o obj\Release\main.o g++.exe -LC:\Users\James\code\nana1-7-2hotfix\build\codeblocks -o ..\bin\testfolderbox.exe obj\Release\main.o -static-libstdc++ -static-libgcc -static -m64 -lnana -lstdc++fs -lgdi32 -lcomdlg32 -lws2_32 -lwsock32 C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: obj\Release\main.o:main.cpp:(.text.startup+0x82): undefined reference to `nana::folderbox::folderbox(nana::detail::basic_window*, std::filesystem::__cxx11::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' ````

The only thing difference I can see is that your build included stdc++fs (which is the hot-fix I assume??).... and I think that hot-fix applied only to c++11 option (???)

The only thing difference I can see is that your build included stdc++fs (which is the hot-fix I assume??).... and I think that hot-fix applied only to c++11 option (???)

Leaving out stdc++fs five nemerous undefined references

g++.exe -LC:\Users\James\code\nana1-7-2hotfix\build\codeblocks -o ..\bin\testfolderbox.exe obj\Debug\main.o   -lnana -lgdi32 -lcomdlg32
C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: obj\Debug\main.o: in function `main':
C:/Users/James/code/testfolderbox/main.cpp:6: undefined reference to `nana::folderbox::folderbox(nana::detail::basic_window*, std::filesystem::__cxx11::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\James\code\nana1-7-2hotfix\build\codeblocks/libnana.a(filebox.o):filebox.cpp:(.text+0x470): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\James\code\nana1-7-2hotfix\build\codeblocks/libnana.a(filebox.o):filebox.cpp:(.text+0x5f0): undefined reference to `std::experimental::filesystem::v1::status(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)'
C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\James\code\nana1-7-2hotfix\build\codeblocks/libnana.a(filebox.o):filebox.cpp:(.text+0xd5a): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
...
Leaving out stdc++fs five nemerous undefined references ```` g++.exe -LC:\Users\James\code\nana1-7-2hotfix\build\codeblocks -o ..\bin\testfolderbox.exe obj\Debug\main.o -lnana -lgdi32 -lcomdlg32 C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: obj\Debug\main.o: in function `main': C:/Users/James/code/testfolderbox/main.cpp:6: undefined reference to `nana::folderbox::folderbox(nana::detail::basic_window*, std::filesystem::__cxx11::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\James\code\nana1-7-2hotfix\build\codeblocks/libnana.a(filebox.o):filebox.cpp:(.text+0x470): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()' C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\James\code\nana1-7-2hotfix\build\codeblocks/libnana.a(filebox.o):filebox.cpp:(.text+0x5f0): undefined reference to `std::experimental::filesystem::v1::status(std::experimental::filesystem::v1::__cxx11::path const&, std::error_code&)' C:/msys64-g92/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\James\code\nana1-7-2hotfix\build\codeblocks/libnana.a(filebox.o):filebox.cpp:(.text+0xd5a): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()' ... ````

OK, I just downloaded the nana hotfix.... and recompile nana... using gcc 9.2 and codeblocks with C++17 enabled... everthing's fine... then I compile your little program above... and working fine also. (All this time without linking to stdc++fs). (Interestingly enough, I don't even have that library, libstdc++fs, in my gcc directory).

So, conclusion: your gcc and mine somehow is a little bit different... ???

OK, I just downloaded the nana hotfix.... and recompile nana... using gcc 9.2 and codeblocks with C++17 enabled... everthing's fine... then I compile your little program above... and working fine also. (All this time without linking to stdc++fs). (Interestingly enough, I don't even have that library, libstdc++fs, in my gcc directory). So, conclusion: your gcc and mine somehow is a little bit different... ???

Same MSYS2... but I didn't download the installer, but instead the tar.xz compressed version and extract it myself... from https://sourceforge.net/projects/msys2/files/Base/x86_64/

For the MinGW... I download the latest v6.0.0 from https://mingw-w64.org/doku.php

Same MSYS2... but I didn't download the installer, but instead the tar.xz compressed version and extract it myself... from https://sourceforge.net/projects/msys2/files/Base/x86_64/ For the MinGW... I download the latest v6.0.0 from https://mingw-w64.org/doku.php
edited Sep 13 at 6:06 pm

There are some flags(marco) to control the std::filesystem, please check whether these flags are consistent between building nana and compiling your program.

cmake option NANA_CMAKE_NANA_FILESYSTEM_FORCE,
marco NANA_FILESYSTEM_FORCE, BOOST_FILESYSTEM_FORCE,STD_FILESYSTEM_FORCE

The purpose of the error-prone configuration is to enable the std::filesystem to work with older compilers. Now I am planning on updating nana to base on C++20.

There are some flags(marco) to control the `std::filesystem`, please check whether these flags are consistent between building nana and compiling your program. cmake option `NANA_CMAKE_NANA_FILESYSTEM_FORCE`, marco `NANA_FILESYSTEM_FORCE`, `BOOST_FILESYSTEM_FORCE`,`STD_FILESYSTEM_FORCE` The purpose of the error-prone configuration is to enable the `std::filesystem` to work with older compilers. Now I am planning on updating nana to base on C++20.

Now I am planning on updating nana to base on C++20.

Please do not do that. Updating to c++17 has caused many problems, some of which are still not fixed. Please focus on v1.7.2 which is broken whether I use c++11 or c++17.

Currently, I cannot release any software using nana because I cannot tell my clients how to build it using the official release. This is becoming a huge problem.

> Now I am planning on updating nana to base on C++20. Please do not do that. Updating to c++17 has caused many problems, some of which are still not fixed. Please focus on v1.7.2 which is broken whether I use c++11 or c++17. Currently, I cannot release any software using nana because I cannot tell my clients how to build it using the official release. This is becoming a huge problem.

marco NANA_FILESYSTEM_FORCE, BOOST_FILESYSTEM_FORCE,STD_FILESYSTEM_FORCE

What is marco? A spelling mistake for macro?

Anyway, I checked both the nana library build and the application build. Neither use any of the compiler defines you mention.

> marco NANA_FILESYSTEM_FORCE, BOOST_FILESYSTEM_FORCE,STD_FILESYSTEM_FORCE What is marco? A spelling mistake for macro? Anyway, I checked both the nana library build and the application build. Neither use any of the compiler defines you mention.

please check whether these flags are consistent between building nana and compiling your program.

Thank you for the hint. I double checked the two builds and founds some discrepancies. Fixing these made the undefined reference error go away.

So, my mistake.

I really like header only libraries, or libraries such as sqlite that provide an amalgamation file for the source code, so it can be built simultaineously with the application. This completely solves the problem of application and library builds drifting out of synchronization. Please consider doing this for nana - you will get a lot fewer build problems posted to this forum.

> please check whether these flags are consistent between building nana and compiling your program. Thank you for the hint. I double checked the two builds and founds some discrepancies. Fixing these made the undefined reference error go away. So, my mistake. I really like header only libraries, or libraries such as sqlite that provide an amalgamation file for the source code, so it can be built simultaineously with the application. This completely solves the problem of application and library builds drifting out of synchronization. Please consider doing this for nana - you will get a lot fewer build problems posted to this forum.

Please consider doing this for nana

I think the main problem is compiling time. Maybe you have a try, create a header file, then include all cpp files, see if the compiling time is acceptable.

>Please consider doing this for nana I think the main problem is compiling time. Maybe you have a try, create a header file, then include all cpp files, see if the compiling time is acceptable.

With modern fast multiple core machines, compile time is rarely an issue. Building the entire nana static library takes 57 seconds, which would only be needed for a complete rebuild. Incremental builds after a bug fix or small feature implementation are unaffected.

With modern fast multiple core machines, compile time is rarely an issue. Building the entire nana static library takes 57 seconds, which would only be needed for a complete rebuild. Incremental builds after a bug fix or small feature implementation are unaffected.

Could you be more specific? How did you got minwg with gcc 9.2 ?? Please...
Here the max is gcc 8.2 :-/
http://mingw-w64.org/doku.php/download

Could you be more specific? How did you got minwg with gcc 9.2 ?? Please... Here the max is gcc 8.2 :-/ http://mingw-w64.org/doku.php/download

Instructions to download and install the latest g++ 64 bit compiler from http://www.msys2.org/

Follow installation instructions on that page. Note that you will have to stop and restart the MSYS2 command line tool several times. To do this, close the window and then run C:\msys64\msys2_shell. When pacman ( packet manager ) reports "there is nothing to do" run it once more with the command

pacman -S mingw-w64-x86_64-toolchain

which will install the latest g++ 64 bit compiler, which a week or so ago was v9.2 - it updates regularly

Instructions to download and install the latest g++ 64 bit compiler from http://www.msys2.org/ Follow installation instructions on that page. Note that you will have to stop and restart the MSYS2 command line tool several times. To do this, close the window and then run C:\msys64\msys2_shell. When pacman ( packet manager ) reports "there is nothing to do" run it once more with the command ```` pacman -S mingw-w64-x86_64-toolchain ```` which will install the latest g++ 64 bit compiler, which a week or so ago was v9.2 - it updates regularly

If your OS is windows and you want the multilib option (i.e., the capacity to compile to both 32-bit and 64-bit executables)... then you can download from this: https://sourceforge.net/projects/mingw-w64/files/Multilib%20Toolchains%28Targetting%20Win32%20and%20Win64%29/ray_linn/

The only downside is, the latest version from that link is gcc 9.1 (whereas, current is 9.2)...

If your OS is windows and you want the multilib option (i.e., the capacity to compile to both 32-bit and 64-bit executables)... then you can download from this: https://sourceforge.net/projects/mingw-w64/files/Multilib%20Toolchains%28Targetting%20Win32%20and%20Win64%29/ray_linn/ The only downside is, the latest version from that link is gcc 9.1 (whereas, current is 9.2)...
12
110
views
21
replies
5
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