C++: fatal error: variant: No such file or directory

Question

When compiling with C + + 17, you will be prompted with “fatal error: variant: no such file or directory” error;

reason

STD:: variant is a feature of C + + 17. Although I compiled and installed gcc7.5.0, I still prompted this error
with the help of colleagues, the problem was solved because GCC did not switch to GCC 7.5.0;

apt-get install gcc-7
apt-get install gcc-7 g++-7
rm /usr/bin/g++
ln -s /usr/bin/g++-7 /usr/bin/g++

Test

1. C + + variables doesn’t like file directories

Accounting subject

Read More: