1
votes

Building target: Lab1 Invoking: MacOS X C++ Linker g++ -o "Lab1" ./src/EclipseR.o ./src/EclipseR_test.o ./src/Row.o ./src/Rows.o
Undefined symbols for architecture x86_64: "Row::AddColumn(int, std::__1::basic_string, std::__1::allocator >)", referenced from: _main in EclipseR.o

Row.h

#fndef ROW_H_
#define ROW_H_
#include <iostream>
using namespace std;
Class Row {
public:
    Row();
    Row(std::string id);
    string id;
    string columns[24]
    void AddColumn(int index, std::string value);
};
#endif

Row.cpp

#include "Row.h"
#include <iostream>
#include <string>
using namespace std;

string columns[24];

Row::Row(){
    // TODO
}

Row::Row(string id) {
    this->id = id;
    cout << "ID: " << this->id;
}

Row::~Row()
{
    //Deconstructor
}

void AddColumn(int index, std::string value)
{
    columns[index] = value;
}
1
You probably shouldn't have the global string columns[24]; in Row.cpp. Perhaps you added this in an attempt to get the file to compile...aschepler
@aschepler Yea c++ in eclipse kept giving me the symbols columns[24] couldn't be found but once I changed the void method to Row::AddColumn the error disappeared.Chanced270

1 Answers

0
votes

I figured out my issue.

in my Row.cpp class I need to change the following

void AddColumn(int index, std::string value){...}

to

void Row::AddColumn(int index, std::string value){...}