Search code examples
cgnu-makebuild-error

Gnu Make Throws Error on Opening Pren in Header Files


I'm getting an odd "expected declaration" error from GNU Make.

inc/pub/teos_config.h:22:28: error: expected declaration specifiers or '...' before '(' token
 #define TEOS_SYSUINT       ((unsigned)TEOS_SYSINT)
                            ^

This is the file...

#ifndef __TEOS_CONFIG_H__
#define __TEOS_CONFIG_H__

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#define TEOS_SYSINT        int32_t
#define TEOS_SYSUINT       ((unsigned)TEOS_SYSINT)

#ifdef __cplusplus
}
#endif

#endif   // __TEOS_CONFIG_H__

Pretty straightforward. I'm new to GNU Make, so maybe I've missed a switch there?


Solution

  • The header is valid, it should compile (I've tried with GCC). So it means that the error comes from another file that includes teos_config.h.

    This is not strictly-speaking a gnu-make error.

    But you should generally be using typedef instead of define for what you're doing

    typedef int32_t TEOS_SYSINT;