gcc 7.2.0 failed with cstdlib:75:15: fatal error: stdlib.h: No such file or directory on a hello-world program

Tim tolez_xuninada@hotmail.com
Tue Feb 13 06:13:00 GMT 2018


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>

Here’s g++ -v:
Reading specs from
/home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/bin/../lib/gcc/x86_64-pc-linux-gnu/7.2.0/specs
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--with-native-system-header-dir=/home/linuxbrew/.linuxbrew/include
--with-local-prefix=/home/linuxbrew/.linuxbrew/local
--with-build-time-tools=/home/linuxbrew/.linuxbrew/opt/binutils/x86_64-pc-linux-gnu/bin
--prefix=/home/linuxbrew/.linuxbrew/Cellar/gcc/7.2.0 --disable-multilib
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-7
--with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp
--with-mpfr=/home/linuxbrew/.linuxbrew/opt/mpfr
--with-mpc=/home/linuxbrew/.linuxbrew/opt/libmpc
--with-isl=/home/linuxbrew/.linuxbrew/opt/isl --with-system-zlib
--enable-stage1-checking --enable-checking=release --enable-lto
--with-boot-ldflags='-static-libstdc++ -static-libgcc -static
-L/home/linuxbrew/.linuxbrew/opt/zlib/lib'
Thread model: posix
gcc version 7.2.0 (GCC)

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



More information about the Gcc-help mailing list