I'm doing an project about satellite communication and need to simulate it in omnet++.
I use Omnet++ 6.0.1 and INET 4.4, the gcc version is 11.3.0, which natively support c++ 17 (and I already set the compiler in c++ 17 mode). The whole project is running in a virtual machine.
I tried to compile one project I found from the git repo (https://github.com/Avian688/leosatellites), but failed with Error: no member named '__fs' in namespace "std".
networklayer/configurator/ipv4/LeoIpv4NetworkConfigurator.cc
networklayer/configurator/ipv4/LeoIpv4NetworkConfigurator.cc:58:13: error: no member named '__fs' in namespace 'std'
if(std::__fs::filesystem::is_directory(filePrefix) || std::__fs::filesystem::exists(filePrefix)) {
~~~~~^
networklayer/configurator/ipv4/LeoIpv4NetworkConfigurator.cc:58:64: error: no member named '__fs' in namespace 'std'
if(std::__fs::filesystem::is_directory(filePrefix) || std::__fs::filesystem::exists(filePrefix)) {
~~~~~^
networklayer/configurator/ipv4/LeoIpv4NetworkConfigurator.cc:180:15: error: no member named '__fs' in namespace 'std'
if (!std::__fs::filesystem::is_directory(filePrefix) || !std::__fs::filesystem::exists(filePrefix)) {
~~~~~^
networklayer/configurator/ipv4/LeoIpv4NetworkConfigurator.cc:180:67: error: no member named '__fs' in namespace 'std'
if (!std::__fs::filesystem::is_directory(filePrefix) || !std::__fs::filesystem::exists(filePrefix)) {
~~~~~^
networklayer/configurator/ipv4/LeoIpv4NetworkConfigurator.cc:181:14: error: no member named '__fs' in namespace 'std'
std::__fs::filesystem::create_directory(filePrefix);
~~~~~^
5 errors generated.
make: *** [Makefile:150: ../out/clang-release/src/networklayer/configurator/ipv4/LeoIpv4NetworkConfigurator.o] Error 1
I generated the makefile with the following command:
opp_makemake --make-so -f --deep -KINET4_4_PROJ=$HOME/omnetpp-6.0.1/samples/inet4.4 -KOS3_PROJ=$HOME/omnetpp-6.0.1/samples/os3 -DINET_IMPORT '-I/home/zzz/omnetpp-6.0.1/samples/leosatellites/src/igraph' '-I$(OS3_PROJ)/src' '-I$(INET4_4_PROJ)/src' '-I/usr/include/x86_64-linux-gnu/curl' '-L/usr/lib' '-L$(INET4_4_PROJ)/src' '-L$(OS3_PROJ)/src' '-ligraph' '-lxml2 -lz' '-lgmp' '-lblas' '-lglpk' '-llapack' '-larpack' '-lINET$(D)' '-los3$(D)'
and make with:
make MODE=release && make MODE=debug
Theoretically, this error should not occur since I already compile the relative project os3 successfully (https://github.com/Avian688/os3) and all other needed packages are installed
I tried to delete all references with "__fs" in the c++ file since in c++17, std::filesystem works, but then new error occured: error: no member named 'filesystem' in namespace 'std'.
I also tried to include the <experimental/filesystem> .h file, which I found in other q&a, also doesn't work.
I used to use the namespace std::filesystem a lot but never came up with such problem, could any one figure it out?
The problem is solved by @Botje. All I need to do is change the default compiler to gcc instead of clang in the configure.user file and recompile the whole omnet++. Then delete all the instances with "__fs" since I set
CXXFLAGS += -std=c++17and it supports member std::filesystem. Then remake the leosatellite project, it works!