I use the below centos8
roboxes/centos8:latest
sh-4.4# cat /etc/redhat-release
CentOS Linux release 8.5.2111
but when I use the g++
compile my C++ program:
sh-4.4# g++ ./hello.cpp -o hello_cpp
I get error:
In file included from /usr/include/errno.h:28,
from /usr/include/c++/8/cerrno:42,
from /usr/include/c++/8/ext/string_conversions.h:44,
from /usr/include/c++/8/bits/basic_string.h:6404,
from /usr/include/c++/8/string:52,
from /usr/include/c++/8/bits/locale_classes.h:40,
from /usr/include/c++/8/bits/ios_base.h:41,
from /usr/include/c++/8/ios:42,
from /usr/include/c++/8/ostream:38,
from /usr/include/c++/8/iostream:39,
from ./hello.cpp:1:
/usr/include/bits/errno.h:26:11: fatal error: linux/errno.h: No such file or directory
# include <linux/errno.h>
^~~~~~~~~~~~~~~
compilation terminated.
my content of hello.cpp
:
sh-4.4# cat hello.cpp
#include <iostream>
using namespace std;
int main() {
cout<<"hello cpp."<<endl;
cout<<"2.xxx"<<endl;
cout<<"3.yyy"<<endl;
return 0;
}