Did you do update recently on newer AIX 72 level ?
In that case probably you will see issue.
There were changes in AIX header files and those might not be there in the gcc include fix hence there is a mismatch.
For gcc working gcc takes AIX header files and make some changes and uses them the fix headers it put in
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/path
This happens at the gcc install time. So if you have installed gcc on AIX and then recently updated AIX (where new header files are added) then those changes will not be there in gcc include-fix path. To bring the include in gcc include-fix you can reinstall gcc.
Try to reinstall latest gcc from AIX toolbox and see if issue goes away.
------------------------------
SANKET RATHI
------------------------------
Original Message:
Sent: Thu December 02, 2021 07:23 AM
From: Andrey Klyachkin
Subject: g++ cstdlib - 'exit' has not been declared
I checked now on AIX 7.3 Open Beta with gcc 10 and it works as expected. What was changed and when can we have gcc10 on AIX 7.2/7.1?
------------------------------
Andrey Klyachkin
https://www.power-devops.com
Original Message:
Sent: Thu December 02, 2021 03:46 AM
From: Andrey Klyachkin
Subject: g++ cstdlib - 'exit' has not been declared
Code:
#include <cstdlib>
int main() {
exit(1);
}
As you may expect, it works perfectly on every operating system except AIX :-)
gcc 8.3.0 with libstdc++ 8.3.0 are installed:
#rpm -qa | grep gcc | sort
gcc-8-1.ppc
gcc-c++-8-1.ppc
gcc-cpp-8-1.ppc
gcc8-8.3.0-6.ppc
gcc8-c++-8.3.0-6.ppc
gcc8-cpp-8.3.0-6.ppc
libgcc-8-1.ppc
libgcc8-8.3.0-6.ppc
#rpm -qa | grep libstdc | sort
libstdc++-8-1.ppc
libstdc++8-8.3.0-6.ppc
libstdc++8-devel-8.3.0-6.ppc
Trying to compile it on AIX I'm getting the following error messages:
#g++ test.cpp
In file included from /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/cstdlib:75,
from test.cpp:1:
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/stdlib.h:341:25: error: 'exit' has not been declared
extern _NORETURN(void, exit)(int);
^~~~
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/stdlib.h:341:34: error: '_NORETURN' declared as function returning a function
extern _NORETURN(void, exit)(int);
^
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/stdlib.h:353:25: error: 'quick_exit' has not been declared
extern _NORETURN(void, quick_exit)(int);
^~~~~~~~~~
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/stdlib.h:353:40: error: '_NORETURN' declared as function returning a function
extern _NORETURN(void, quick_exit)(int);
^
In file included from test.cpp:1:
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/cstdlib:146:11: error: '::exit' has not been declared
using ::exit;
^~~~
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include/c++/cstdlib:160:11: error: '::quick_exit' has not been declared
using ::quick_exit;
^~~~~~~~~~
test.cpp: In function 'int main()':
test.cpp:4:3: error: 'exit' was not declared in this scope
exit(1);
^~~~
test.cpp:4:3: note: suggested alternative: 'ecvt'
exit(1);
^~~~
ecvt
What am I missing / doing wrong here?
------------------------------
Andrey Klyachkin
https://www.power-devops.com
------------------------------