Why gcc cannot resolve symbol?
Hey
following code seems not create a warning:
Code:
/* * main.c
*
* Created on: Jul 21, 2019
* Author: Niclas Schwalbe
*/
#include <stdlib.h>
#include <stdio.h>
#include "board.h"
#include "chess.h"
#include "odinutilities.h"
void printBoard(BOARD_STATE* state){
for(int i = BOARD_LEN-1; i >= 0; i--){
for(int k = 0; k < BOARD_LEN; k++){
printf("%d,", (state->board[i][k]));
}
printf("\n");
}
}
char* create_move_string(char from_x, char from_y, char to_x, char to_y, char promotion_piece) {
char* move = malloc(CHARS_TO_EXPRESS_MOVE); //WARNING SYMBOLS CHARS_TO_EXPRESS_MOVE COULD NOT BE RESOLVED
move[0] = from_x;
move[1] = from_y;
move[2] = to_x;
move[3] = to_y;
move[4] = promotion_piece;
return move;
}
void printMoves(char** moves, size_t length, char translate_for_human){
}
Code:
#include "board.h"#include "odinutilities.h"
#ifndef CHESS_H
#define CHESS_H
#define PAWNS_DEGREES_OF_FREEDOM 3
#define CHARS_TO_EXPRESS_MOVE 5
enum piece {free_piece, pawn, knight, bishop, rock, queen, king};
enum color {white, black};
typedef struct {
BOARD_STATE board_state;
FILE* plast_moves_file;
} CHESS_STATE;
#endif
Problem description: Symbol 'CHARS_TO_EXPRESS_MOVE'
could not be resolved
Can you figure out why?
Thanks!