FT_ERROR_H does not look like the name of a header file, maybe you are referring to "ft/error.h"?
In addition, precompilation like #include can pass, and the text in the header file will be replaced here. But this is not conducive to debugging. You can talk about your needs and we can do it in another way.
The include directive must be defined in the file field (not only in the file header!), and must be defined before using any function package or variable defined in it for the first time.
See ISO/IEC 9899:1999 standard section 7.1.2: If used, a header shall be included outside of any external declaration or definition, and it shall first be included before the first reference to any of the functions or objects it declares, or to any of the types or macros it defines.
In response to your problem, the #include directive should be removed from ft_errors:
#include FT_ERRORS_H
// I assume that FT_ERRORS_H has been correctly defined with corresponding header file name
static const struct ft_error ft_errors[] =
{
// concrete struct definition/declaration
};
#include
can only appear at the beginning of the fileSuppose your header file is defined as FT_ERRORS_H.h, you need to modify it to
static const struct ft_error ft_errors[] =
{
};
That is, the header file needs to be included. When the compiler compiles, the contents in the header file will be mapped into the array.
FT_ERROR_H does not look like the name of a header file, maybe you are referring to "ft/error.h"?
In addition, precompilation like #include can pass, and the text in the header file will be replaced here. But this
is not conducive to debugging. You can talk about your needs and we can do it in another way.
The include directive must be defined in the file field (not only in the file header!), and must be defined before using any function package or variable defined in it for the first time.
See ISO/IEC 9899:1999 standard section 7.1.2:
If used, a header shall be included outside of any external declaration or definition, and it shall first be included before the first reference to any of the functions or objects it declares, or to any of the types or macros it defines.
In response to your problem, the #include directive should be removed from ft_errors:
Reference:
http://stackoverflow.com/questions/16389126/can-the-pre-processor-directives-like-include-be-placed-only-at-the-top-of-the
http://www.dii.uchile.cl/~daespino/files/Iso_C_1999_definition.pdf