So i've created:
main.cpp (creates 2d-array, then makes calls on 2 functions and passes 2d-array)
functions.cpp (contains 2 functions being called)
functions.h (has prototypes of 2 functions)
main.cpp:
#include <iostream>
#include "functions.h"
using namespace std;
functions.h:
namespace func {
int findWord(char (*Array2D)[10], int i, char c);
void printWord(char (*Array2D)[10], int i);
}
I left out some code because it's not relevant to my question. I essentially need to pass the 2d-array that I created in the main.cpp, and be able to use the functions I've created in functions.cpp. It compiles I believe, but doesn't run and gives me an error:
Undefined symbols for architecture x86_64:
"func::findWord(char (*) [10], int, char)", referenced from:
_main in main.o
"func::printWord(char (*) [10], int)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
namespace func{
int findWord(char (*Array2D)[10], int i, char c);//1d character array with 10 elements
void printWord(char (*Array2D)[10], int i);//1d character array with 10 elements
}
should be:
1 2 3 4
namespace func{
int findWord(char Array2D[][10], int i, char c);
void printWord(char Array2D[][10], int i);
}