make:*** [Lab1]错误1

时间:2013-09-13 05:28:25

标签: c++ eclipse makefile binaries

我已经阅读了所有内容Make: *** [] Error 1,我在主方法中返回0。

我尝试过切换解析器,但这也不起作用。我已经尝试了内部构建,但是不起作用(即使它确实我想使用makefile)。

以下是给出错误的示例。我相信这是阻止我创建二进制文件的必要条件,以便运行我的应用程序。

错误图片链接 - > http://upit.cc/i/c6b2db81.png

这是控制台位。我做了一个刷新然后构建。

23:52:19 **** Build of configuration Debug for project Lab1 ****
make all 
Building file: ../src/Run.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Run.d" -MT"src/Run.d" -o "src/Run.o" "../src/Run.cpp"
Finished building: ../src/Run.cpp

Building file: ../shared-src/EndToken.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"shared-src/EndToken.d" -MT"shared-src/EndToken.d" -o "shared-src/EndToken.o" "../shared-src/EndToken.cpp"
Finished building: ../shared-src/EndToken.cpp

Building file: ../shared-src/ErrorToken.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"shared-src/ErrorToken.d" -MT"shared-src/ErrorToken.d" -o "shared-src/ErrorToken.o" "../shared-src/ErrorToken.cpp"
Finished building: ../shared-src/ErrorToken.cpp

Building file: ../shared-src/Token.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"shared-src/Token.d" -MT"shared-src/Token.d" -o "shared-src/Token.o" "../shared-src/Token.cpp"
Finished building: ../shared-src/Token.cpp

Building file: ../server-src/server-token/SToken.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"server-src/server-token/SToken.d" -MT"server-src/server-token/SToken.d" -o "server-src/server-token/SToken.o" "../server-src/server-token/SToken.cpp"
Finished building: ../server-src/server-token/SToken.cpp

Building file: ../server-src/server-token/StartSToken.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"server-src/server-token/StartSToken.d" -MT"server-src/server-token/StartSToken.d" -o "server-src/server-token/StartSToken.o" "../server-src/server-token/StartSToken.cpp"
Finished building: ../server-src/server-token/StartSToken.cpp

Building file: ../server-src/Message.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"server-src/Message.d" -MT"server-src/Message.d" -o "server-src/Message.o" "../server-src/Message.cpp"
Finished building: ../server-src/Message.cpp

Building file: ../server-src/Server.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"server-src/Server.d" -MT"server-src/Server.d" -o "server-src/Server.o" "../server-src/Server.cpp"
Finished building: ../server-src/Server.cpp

Building file: ../server-src/User.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"server-src/User.d" -MT"server-src/User.d" -o "server-src/User.o" "../server-src/User.cpp"
Finished building: ../server-src/User.cpp

Building target: Lab1
Invoking: GCC C++ Linker
g++  -o "Lab1"  ./src/Run.o  ./shared-src/EndToken.o ./shared-src/ErrorToken.o ./shared-src/Token.o  ./server-src/server-token/SToken.o ./server-src/server-token/StartSToken.o  ./server-src/Message.o ./server-src/Server.o ./server-src/User.o   
./shared-src/Token.o:(.rodata._ZTV5Token[_ZTV5Token]+0x20): undefined reference to `Token::getNextToken(char*)'
./shared-src/Token.o:(.rodata._ZTV5Token[_ZTV5Token]+0x28): undefined reference to `Token::processToken(char*)'
collect2: error: ld returned 1 exit status
make: *** [Lab1] Error 1
23:52:20 Build Finished (took 904ms)

从图像中可以看出,Lab1没有二进制文件,它显示了make错误。

感谢大家发表评论

我将此代码作为对此问题的评论的参考。

/*
 * Token.h
 *
 *  Created on: Sep 12, 2013
 *      Author: cam
 */
#pragma once

class Token {

public:
    Token();
    virtual ~Token();

    enum TOKEN_TYPE {START, MIDDLE, END, ERROR};
    /**
     * @pre processToken must be ran first!
     */
    virtual Token getNextToken(char*);
    virtual bool processToken(char*);

};

/ *  * Token.cpp  *  *创建日期:2013年9月12日  *作者:cam  * /

#include "Token.h"

Token::Token() {

}

Token::~Token() {

}

Token Token::getNextToken(char* buff) {

}

bool Token::processToken(char * buff) {

}

1 个答案:

答案 0 :(得分:1)

最终我没有在我的基类中包含两个虚方法定义。虽然这可以编译,但我很想知道为什么这是必要的,因为它们被定义为虚拟。