I have these two files, functions.c and constants.h.
functions.c has this line:
#include "constants.h"
However, when I try to compile functions.c, functions.c functions can’t find these constants from constants.c. These are const type constants. I know it’s a very noobish problem, but I don’t know the solution.
EDIT:
Files content (some of them):
functions.c:
#include <string.h>
#include "Directivas.h"
...
int hayDirectivaInclude(char* buffer) {
if (strncmp(include, buffer, longInclude) == 0)
return 1;
else
return 0;
}
constants.h:
const char include[10] = { '#', 'i', 'n', 'c', 'l', 'u', 'd', 'e', ' ', 0 };
const int longInclude = 9;
Your
constants.hmust containexternreferences to the constants.For example, suppose you had:
const char* COOL_STRING = "Erandros is cool."in constants.c. In order forfunctions.cto know about this string, you must inform it of its existence by writingextern char* COOL_STRING;somewhere, such as inconstants.h