I'm trying to run a function from my main.cpp file that takes a string and the command-line arguments. These are what my files look like. (I've excluded the unnecessary includes and variables, because I don't think they're relevant to this issue)
main.cpp
#include "lib/run.h"
int main(int argc, char *argv[]){
kiwi_process runfile;
runfile.run(input, argv);
}
lib/run.h
class kiwi_process {
public:
void run(std::string content, char** args);
};
lib/run.cpp
#include <iostream>
#include <string>
#include "run.h"
int kiwi_process::run(std::string content, char** args){
std::cout << content;
}
I'm compiling with
g++ -o kiwi main.cpp -std=gnu++17
And it's erring
Undefined symbols for architecture x86_64:
"kiwi_process::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, char**)", refere
nced from:
_main in main-8b6378.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What am I doing wrong?