I don\'t know what I am doing wrong? Can someone help? Thank you. #include #incl
ID: 3849850 • Letter: I
Question
I don't know what I am doing wrong? Can someone help? Thank you.
#include #include #define DOWN 1//move DOWN #define RIGHT 2//move RIGHT #define LEFT 3//move LEFT #define UP 4//move UP //starting X and Y coordinate for Maze #define X_START 2 #define Y_START 0 //function prototypes 17 void mazeTraverseC char maze [12][12], int xCoord, int yCcord, int direction): void printMoze() const char maze [][12]): int validMove(const char maze [] [12], int r, int c): int checkForEdge(int x, int y): int main(void) { //maze grid char maze [12][12] = 39 mazeTraverseC maze, X_START, Y_START, RIGHT): 40 return 0: gcc version 4.6.3 /tmp/ccCXjzG7.os In function "main": main.c: (.text+0 times 295)t undefined reference to 'mazeTraverse' collect2: error: Id returned 1 exit status exit status 1Explanation / Answer
The problem is that you have defined the function prototypes but you have not created a implementation of those protoypes.
You have to implement all the functions mentioned in the function prototypes separately.
for example if you have a function named sum(int a,int b) which return sum of two elements, you first define the prototypes as:
int sum(int a,int b);
and after defining the prototype you have to write code for what the function should do as:
int sum(int a,int b){
return a+b;
}
Only then you can call this function from main function, otherwise you get the error undefined reference to sum
I highly recommend you to go through your text book about functions before writing any programs.
Give a thumbs up, if you liked the solution.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.