Solved what c++ to use doing C++?

I am not even sure how I ended up with two versions of gcc, but I am trying to replace boost with what gcc added into their stuff now. Using their slightly modified example.




Code:
#include <fstream>
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;

int main()
{

/***
    fs::create_directories("sandbox/a/b");
    std::ofstream("sandbox/file1.txt");
    fs::create_symlink("a", "sandbox/syma");
***/

   for(auto& p: fs::recursive_directory_iterator("/media/data1/wallhaven-papers"))
        std::cout << p.path() << '\n';
    fs::remove_all("/media/data1/wallhaven-papers");
}

Code:
[userx@FreeBSD64ssd test]$ g++9  -std=c++17 main.cpp
[userx@FreeBSD64ssd test]$ ./a.out
ld-elf.so.1: /usr/local/lib/gcc8/libstdc++.so.6: version GLIBCXX_3.4.26 required by /usr/home/userx/test/a.out not found
Code:
[userx@FreeBSD64ssd test]$ c++  -std=c++17 main.cpp
main.cpp:3:10: fatal error: 'filesystem' file not found
#include <filesystem>
         ^~~~~~~~~~~~
1 error generated.


Code:
[userx@FreeBSD64ssd test]$ sudo pkg info gcc9
gcc9-9.2.0
Name           : gcc9
Version        : 9.2.0
Installed on   : Tue Sep  3 16:29:19 2019 CDT
Origin         : lang/gcc9
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : lang
Licenses       : GPLv3, GPLv3RLE
Maintainer     : gerald@FreeBSD.org
WWW            : https://gcc.gnu.org
Comment        : GNU Compiler Collection 9
Options        :
    BOOTSTRAP      : on
    GRAPHITE       : off
    MULTILIB       : on
Shared Libs required:
    libmpc.so.3
    libgmp.so.10
    libmpfr.so.6
Shared Libs provided:
    libitm.so.1
    libssp.so.0
    libatomic.so.1
    libcc1plugin.so.0
    libcc1.so.0
    libgcc_s.so.1
    libquadmath.so.0
    libcp1plugin.so.0
    liblto_plugin.so.0
    libstdc++.so.6
    libgomp.so.1
    libgfortran.so.5
Annotations    :
    FreeBSD_version: 1200086
    cpe            : cpe:2.3:a:gnu:gcc:9.2.0:::::freebsd12:x64
Flat size      : 199MiB
Description    :
GCC, the GNU Compiler Collection, supports a number of languages.
This port installs the C, C++, and Fortran front ends as gcc9, g++9,
and gfortran9, respectively.

WWW: https://gcc.gnu.org

Gerald Pfeifer <gerald@FreeBSD.org>
gcc8
Code:
[userx@FreeBSD64ssd test]$ sudo pkg info gcc8
gcc8-8.3.0_2
Name           : gcc8
Version        : 8.3.0_2
Installed on   : Sun Sep  1 17:02:20 2019 CDT
Origin         : lang/gcc8
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : lang
Licenses       : GPLv3, GPLv3RLE
Maintainer     : gerald@FreeBSD.org
WWW            : https://gcc.gnu.org
Comment        : GNU Compiler Collection 8
Options        :
    BOOTSTRAP      : on
    GRAPHITE       : off
    MULTILIB       : on
Shared Libs required:
    libmpc.so.3
    libgmp.so.10
    libmpfr.so.6
Shared Libs provided:
    libitm.so.1
    libssp.so.0
    libatomic.so.1
    libcc1plugin.so.0
    libcc1.so.0
    libgcc_s.so.1
    libquadmath.so.0
    libcp1plugin.so.0
    liblto_plugin.so.0
    libstdc++.so.6
    libgomp.so.1
    libgfortran.so.5
Annotations    :
    FreeBSD_version: 1200086
    cpe            : cpe:2.3:a:gnu:gcc:8.3.0:::::freebsd12:x64:2
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 188MiB
Description    :
GCC, the GNU Compiler Collection, supports a number of languages.
This port installs the C, C++, and Fortran front ends as gcc8, g++8,
and gfortran8, respectively.

WWW: https://gcc.gnu.org

Gerald Pfeifer <gerald@FreeBSD.org>

whating to try and keep this uniformed, where it looks like gcc knows <filesystem> and c++ does not, yet neither work in the end.


what to do?
 
delete gcc8

Code:
-----------------------------------------------
[userx@FreeBSD64ssd ~]$ sudo pkg delete gcc8
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 2 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    gcc8-8.3.0_3
    gcc-8_3

Number of packages to be removed: 2

The operation will free 188 MiB.

Proceed with deinstalling packages? [y/N]: y
[1/2] Deinstalling gcc-8_3...
[1/2] Deleting files for gcc-8_3: 100%
[2/2] Deinstalling gcc8-8.3.0_3...
[2/2] Deleting files for gcc8-8.3.0_3: 100%
[userx@FreeBSD64ssd ~]$ sudo pkg autoremove 
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages:

Installed packages to be REMOVED:
    perl5.30-5.30.0

Number of packages to be removed: 1

The operation will free 58 MiB.


[userx@FreeBSD64ssd test]$ g++9  -std=c++17 main.cpp
[userx@FreeBSD64ssd test]$ ./a.out
"/media/data1/wallhaven-papers/wallhaven-4765ey.jpg"
"/media/data1/wallhaven-papers/wallhaven-nkzr91.jpg"
"/media/data1/wallhaven-papers/wallhaven-42jey9.jpg"
 
Back
Top