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

新手上路,请多包涵

我正在尝试从 https://sourceforge.net/projects/sserver/?source=typ_redirect 安装 Robocup 模拟器。如要构建它的文件夹中的 README 文件中所述,我必须执行 /.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.

现在,我应该怎么做才能安装模拟器?谢谢!

原文由 talos1904 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 764
2 个回答

apt-get 可以找到多个版本的g++,甚至可以并排安装。但显然命令行上的“g++”必须是其中一个的快捷方式。您可以使用 sudo update-alternatives --config g++ 更改该快捷方式。

原文由 MSalters 发布,翻译遵循 CC BY-SA 3.0 许可协议

首先确保 g++ 在您的 PATH 变量中。 echo $PATH 看它是否至少包含 /bin:/usr/bin

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

如果这没有帮助,请尝试重新安装 g++ apt-get remove g++; apt-get install g++

原文由 xiaobing 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题