Something went wrong with your GCC installation. Try reinstalling the it like this:
sudo apt-get install --reinstall g++-5
In Ubuntu the g++ is a dependency package that installs the default version of g++ for your OS version. So simply removing and installing the package again won't work, cause it will install the default version. That's why you need to reinstall.
Note: You can replace the g++-5 with your desired g++ version. To find your current g++ version run this:
g++ --version
Addition:
The GCC and G++ versions should match. You can check the default versions like this:
gcc --version g++ --version
If the versions don't match, install the latest versions that match with (replace 12 with the desired version):
sudo apt-get install --reinstall gcc-12 sudo apt-get install --reinstall g++-12
After the installation is done, check the default versions again with the commands above. If the versions of GCC and G++ still don't match, check all available/installed versions with:
dpkg -l | grep gcc | awk '{print $2}' dpkg -l | grep g++ | awk '{print $2}'
If there are multiple versions for each package, create a list of compiler alternatives like this:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
Then check the available compilers with the commands below. Each one will show a list with options - choose the default version by typing the selection number:
sudo update-alternatives --config gcc sudo update-alternatives --config g++
And you're done! Now check the default versions again - they should match!
Source: linuxconfig.org
php xx.phpashttpuser. all of them is success... and the output ofg++ -vin php code is similar with its in shell..gcc -print-search-dirshow about this? Are the outputs the same?