1

I already read everything Make: *** [] Error 1 and I am returning a 0 in my main method.

I've tried switching up parsers, but that doesn't work either. I've tried the internal build, that doesn't work (and even if it did I want to work with makefile's).

Here's an example of the error being given. I believe this is what's preventing me from creating the binary files which is a must have in order to run my app.

Error image link -> http://upit.cc/i/c6b2db81.png

Here's the console bit. I did a refresh and then build.

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)

As you can see from the image, Lab1 has no Binaries and it's showing the make error.

Solution found thanks to guys commenting

I'm including this code as reference to the comments to this question.

/*
 * 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 * * Created on: Sep 12, 2013 * Author: cam */

#include "Token.h"

Token::Token() {

}

Token::~Token() {

}

Token Token::getNextToken(char* buff) {

}

bool Token::processToken(char * buff) {

}
Community
  • 1
  • 1
CamHart
  • 3,825
  • 7
  • 33
  • 69
  • 2
    Please copy the text from the "Console" tab, and edit your question to include the *complete* and *unedited* error message. The one here just says that the build process failed, nothing more. – Some programmer dude Sep 13 '13 at 05:30
  • Hey, I've included the bit you asked. Thanks, I'm very very new to c++. When the error is simply stating my project name your suggesting I leave that in there? – CamHart Sep 13 '13 at 05:55
  • 1
    What file are `Token::getNextToken(char*)` and `Token::processToken(char*)` implemented in? Show us that code. – Retired Ninja Sep 13 '13 at 05:55
  • Okay so It's compiling now. I added method definitions to the two methods you commented out above. I want Token to be an abstract base class though, and both of those methods are virtual. Is it necessary for me to define them? – CamHart Sep 13 '13 at 05:59
  • Without seeing the applicable code it's hard to say. – Retired Ninja Sep 13 '13 at 06:02
  • I've added the code the original question. Thanks for all the help too guys, I appreciate it. I feel like an idiot not realizing the console printed more detailed information out, but then again this is my first dance with C++. – CamHart Sep 13 '13 at 06:09

1 Answers1

1

Ultimately I wasn't including two virtual method definitions in my base class. While this got it to compile, I'm curious to know why this is necessary as they are defined as virtual.

Lii
  • 11,553
  • 8
  • 64
  • 88
CamHart
  • 3,825
  • 7
  • 33
  • 69
  • 1
    `virtual` just means that if you use a base pointer to a subclass and call the function it will call the function in the subclass. Since you mentioned making the class abstract what you probably want is a pure virtual function. – Retired Ninja Sep 13 '13 at 21:26