I compiled gcc9 from source, and used default install prefix:
./configure --disable-mutilib
make -j16
make install
After that, I found the gcc version is updated:
which gcc
/usr/local/bin/gcc
gcc --version
gcc (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
However, when I use it in my code:
#include <filesystem>
....
I compiled it with cmake as I used default system gcc:
mkdir -p build
cmake ..
make
I got the errors of:
/root/cpp/main_demo.cpp:17:22: fatal error: filesystem: No such file or directory compilation terminated. ...
I am sure the file filesystem
exists in my install path, since I can find it with `find /usr/local -iname 'filesystem'.
What did I miss and how could I make it work?