Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

syntax error - token ";" inserted before "variable name"

Tags:

c

extern

header

I'm programming in C. I'm getting the following error:

ctc E208: ["..\..\ECB\Include\ecb.h" 4/11] syntax error - token ";"
inserted before "u8_vTeethBeforeMissingTeeth1"

Here is what I have in the .h file:

#ifndef __ECB_H__
#define __ECB_H__

extern u8 u8_vTeethBeforeMissingTeeth1;
extern u8 u8_vTeethBeforeMissingTeeth2;

#endif /* __ECB_H__ */

Can anyone please tell me what am I missing in this section of code?

like image 524
Angelo Avatar asked Mar 23 '26 07:03

Angelo


1 Answers

The trouble is that your header is not self-contained. It relies on a type 'u8' which is not defined here (and not defined in any of the other headers you've included before this). You should include the header that defines 'u8' in your 'ecb.h' header before declaring your 'missing teeth' variables.

Headers should be self-contained; if you need the services of the header, you should be able to include it without worrying about what else needs to be included. The standard C headers do that for you - you should do it for yourself with your own headers.

like image 51
Jonathan Leffler Avatar answered Mar 25 '26 20:03

Jonathan Leffler