C++ Eclipse 使错误 127

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3478877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 12:55:25  来源:igfitidea点击:

Eclipse Make Error 127

c++linuxeclipsecompiler-errors

提问by prabhu

this is my first time using Eclipse, and my first time programming in a linux environment. So I might end up posting some semi-usless information, but I'm just trying to give what ever details I can.

这是我第一次使用 Eclipse,也是我第一次在 linux 环境中编程。所以我最终可能会发布一些半无用的信息,但我只是想尽我所能提供详细信息。

The Issue:I'm trying to build a project, and I'm getting the following errors and warnings.

问题:我正在尝试构建一个项目,但收到以下错误和警告。

The Question:What would I have to do, and or get, in order to start working with c++ in linux, within an IDE? Fixing the error would be great, but the above stated is my underlying goal.

问题:为了在 IDE 中开始在 linux 中使用 c++,我必须做什么或得到什么?修复错误会很棒,但上述是我的基本目标。

IDE Info:

IDE信息:

Eclipse
Version: Helios Release
Build id: 20100617-1415

OS Info:

操作系统信息:

Fedora 13: i686

Errors(1 item)

错误(1 项)

make: *** [src/xoorMath.o] Error 127 xoorMath C/C++ Problem

Warnings(2 items)

警告(2项)

Error launching external scanner info generator (g++ -E -P -v -dD /home/xoorath/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp) xoorMath Unknown  C/C++ Problem
Error launching external scanner info generator (g++ -E -P -v -dD /home/xoorath/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp) xoorMath Unknown  C/C++ Problem

Source Code

源代码

//============================================================================
// Name        : xoorMath.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!

    return 0;
}

Generated Makefile

生成的 Makefile

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables 

# All Target
all: xoorMath

# Tool invocations
xoorMath: $(OBJS) $(USER_OBJS)
    @echo 'Building target: $@'
    @echo 'Invoking: GCC C++ Linker'
    g++  -o"xoorMath" $(OBJS) $(USER_OBJS) $(LIBS)
    @echo 'Finished building target: $@'
    @echo ' '

# Other Targets
clean:
    -$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) xoorMath
    -@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets

EDITTried running 'gcc -E -P -v -dD /home/xoorath/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp'

编辑尝试运行'gcc -E -P -v -dD /home/xoorath/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp'

[root@wt227-09-fedora xoorath]# gcc -E -P -v -dD /home/xoorath/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp
Using built-in specs.
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC) 
COLLECT_GCC_OPTIONS='-E' '-P' '-v' '-dD' '-mtune=generic' '-march=i686'
 cc1plus -E -quiet -v -P -D_GNU_SOURCE /home/xoorath/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp -mtune=generic -march=i686 -dD
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
[root@wt227-09-fedora xoorath]# 

回答by

Simple solution really. Turns out I didn't have g++. I installed gcc, and perhapse somebody here knows the difference, if so feel free to enlighten me.

真正简单的解决方案。原来我没有g++。我安装了 gcc,也许这里有人知道其中的区别,如果知道,请随时启发我。

I had to go into the console and do the following

我不得不进入控制台并执行以下操作

yum install gcc-c++

Thats it.

就是这样。

回答by prabhu

Following are the values the make returns.

以下是 make 返回的值。

0 - if all makefiles were successfully parsed and no targets that were built failed 1 - if the -q flag was used and make determines that a target needs to be rebuilt 2 - if any errors were encountered.

0 - 如果所有 makefile 都被成功解析并且没有构建失败的目标 1 - 如果使用了 -q 标志并且 make 确定需要重新构建目标 2 - 如果遇到任何错误。

and any errors numbers of form,

以及任何形式的错误编号,

‘[foo] Error NN' ‘[foo] signal description' These errors are not really make errors at all. They mean that a program that make invoked as part of a recipe returned a non-0 error code (‘Error NN'), which make interprets as failure, or it exited in some other abnormal fashion (with a signal of some type).

'[foo] Error NN' '[foo] 信号描述' 这些错误根本不是真正的错误。它们意味着作为配方的一部分调用 make 的程序返回了一个非 0 错误代码('Error NN'),它解释为失败,或者它以某种其他异常方式退出(带有某种类型的信号)。

If no *is attached to the message, then the subprocess failed but the rule in the makefile was prefixed with the - special character, so make ignored the error.

如果没有*附加到消息,则子进程失败,但 makefile 中的规则以 - 特殊字符为前缀,因此 make 忽略了错误。

So, here the case of make returning the value of 127, is returned by the shell not from make. Please refer man page of bash.

所以,这里 make 返回值 127 的情况是由 shell 返回的,而不是由 make 返回的。请参考 bash 的手册页。