c++ - ld: symbol(s) not found for architecture x86_64 Row::AddColumn -
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 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; }
i figured out issue.
in row.cpp class need change following
void addcolumn(int index, std::string value){...}
to
void row::addcolumn(int index, std::string value){...}
Comments
Post a Comment