C++ 配置:错误:C++;编译器无法创建可执行文件

C++ 配置:错误:C++;编译器无法创建可执行文件,c++,g++,robocup,C++,G++,Robocup,我正在尝试从安装Robocup模拟器。正如在文件夹中的自述文件中提到的,要构建它,我必须执行/.configure,但我遇到了这个错误 saurabh@saurabh-GL502VM:~/intelligent_systems/project/rcssserver-15.3.0$ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment

我正在尝试从安装Robocup模拟器。正如在文件夹中的自述文件中提到的,要构建它,我必须执行/.configure,但我遇到了这个错误

saurabh@saurabh-GL502VM:~/intelligent_systems/project/rcssserver-15.3.0$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether the C++ compiler works... no
configure: error: in `/home/saurabh/intelligent_systems/project/rcssserver-15.3.0':
configure: error: C++ compiler cannot create ex
现在当我检查我的g++编译器时

saurabh@saurabh-GL502VM:~/intelligent_systems/project/rcssserver-15.3.0$ g++ -v
The program 'g++' is currently not installed. You can install it by typing:
sudo apt install g++
但当我尝试安装g++编译器时,我得到了以下结果:

saurabh@saurabh-GL502VM:~/intelligent_systems/project/rcssserver-15.3.0$ sudo apt install g++
Reading package lists... Done
Building dependency tree       
Reading state information... Done
g++ is already the newest version (4:5.3.1-1ubuntu1).
The following packages were automatically installed and are no longer required:
  cpp-4.8 libcloog-isl4 xserver-xorg-legacy
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

现在,我应该如何安装模拟器?谢谢

首先确保g++位于PATH变量中
echo$PATH
查看它是否至少包含
/bin:/usr/bin

然后尝试
find/-name g++
,如果找到了它,请将包含它的文件夹添加到路径中


如果没有帮助,请尝试重新安装g++
apt-get-remove g++;apt get install g++
apt get
可以找到多个版本的g++,甚至可以并排安装。但很明显,命令行上的“g++”必须是其中一个的快捷方式。您可以使用
sudo update alternations--config g++
更改该快捷方式

检查configure命令中使用的编译器版本。我用命令g++--version检查了g++版本。它显示了4.9.2。所以我将编译器指定为g++-4.9.2。但是命令g++-4.9.2没有别名。唯一可用的编译器是g++-4.9。因此,它可以通过在命令行上手动键入来检查是否有可用的g++版本的确切命令。

列出所有gcc安装和链接

ls -la /usr/bin | grep gcc
首先尝试
ls/usr/lib/gcc
,如果存在,请尝试
ln-s/usr/lib/gcc/usr/bin/gcc
PATH=$PATH:/usr/lib/gcc
并执行
/configure
(如果安装了它,它肯定会工作!)

不同的linux发行版有一个值得注意的问题,首先删除并重新安装g++

$: apt remove g++
$: apt install g++
搜索gcc并添加它,如果没有输出任何内容,请尝试添加它

$: which gcc  
如果找到,则将其添加到路径中(如果软链接已创建,则为/usr/bin/gcc或/usr/lib/gcc)

如果结果是什么(可能需要一段时间)尝试,(在这里尝试构建您自己的,也许可以。否则)

通常,它将是/usr/lib/gcc,如果可用,将软链接到/usr/bin/gcc的位置

ln -s /**/*/gcc /usr/bin/gcc
运行
/configure


当我试图用
libc++
clang
构建一个项目时,我也遇到了同样的错误。在对
config.log
文件进行了一些探索之后,我发现需要
libc++abi-9-dev
软件包,这在我的系统中是缺失的(基于rpm的deb软件包的名称可能略有不同)。安装上面的软件包后,错误消失了

我重新安装了g++并且由于安装了两个版本的g++而导致系统冲突。所以,我移除了其中一个,现在一切都好了。谢谢嘿是的,这将工作,但无论如何它删除了一个g++版本。现在,一切正常。
$:find / -name gcc
ln -s /**/*/gcc /usr/bin/gcc