I have a problem with compiling .cpp files with g++ on Fedora Workstation 39(Gnome)

when i run g++ .cpp i get this error:

In file included from /usr/include/c++/13/bits/requires_hosted.h:31,

from /usr/include/c++/13/iostream:38,

from p.cpp:1:

/usr/include/c++/13/i686-redhat-linux/bits/c++config.h:679:10: fatal error: bits/os_defines.h: No such file or directory

679 | #include <bits/os_defines.h>

| ^~~~~~~~~~~~~~~~~~~

compilation terminated.

Firstly i got error saying that it cant find c++config.h header but it was resolved by running this line in termianl:

sudo ln -s …/i686-redhat-linux/bits/c++config.h ./c++config.h

Thank you in advance, every help is appreciated.

Do you have libstdc++-devel package installed?

% dnf whatprovides /usr/include/c++/13/i686-redhat-linux/bits/c++config.h
Last metadata expiration check: 1 day, 0:59:18 ago on Thu 22 Feb 2024 08:52:40 PM.
libstdc++-devel-13.2.1-3.fc39.i686 : Header files and libraries for C++ development
Repo        : fedora
Matched from:
Filename    : /usr/include/c++/13/i686-redhat-linux/bits/c++config.h

libstdc++-devel-13.2.1-6.fc39.i686 : Header files and libraries for C++ development
Repo        : updates
Matched from:
Filename    : /usr/include/c++/13/i686-redhat-linux/bits/c++config.h

That package also provides the missing
/usr/include/c++/13/i686-redhat-linux/bits/c++config.h.