On 2018-02-13 00:13 -0600, Tim wrote: > Hi, > > I have the following program test.cpp: > > #include<iostream> > using namespace std; > int main(int argc, char* argv[]) { > cout << "hello\n"; > } > > And I was trying to compile it with g++ 7.2.0: g++ test.cpp -o test and I > got: > > In file included from > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/ext/string_conversions.h:41:0, > from > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/basic_string.h:6159, > from > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/string:52, > from > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/locale_classes.h:40, > from > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/ios_base.h:41, > from > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/ios:42, > from > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/ostream:38, > from > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/iostream:39, > from test.cpp:9: > /home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/include/c++/7.2.0/cstdlib:75:15: > fatal error: stdlib.h: No such file or directory > #include_next <stdlib.h> Try `echo "" | gcc -E -x c - -v` to see the include searching path. It should contain the location of your `stdlib.h`. (For example `/usr/include` on most Linux dists.) I think `--with-native-system-header-dir=/home/linuxbrew/.linuxbrew/include` causes the problem. > I’m not sure if I had gcc compiled correctly. Can anyone help here? > > Thanks, > Tim > > > > > > -- > Sent from: http://gcc.1065356.n8.nabble.com/gcc-Help-f629689.html -- Xi Ruoyao <ryxi@xxxxxxxxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University