expected initializer before 'char'

Hi,

I have just tried to recompile my 3 year old arduino code by using the latest arduino IDE.
Following error comes up and I have not found a solution by searching the forum.
Error:
expected initializer before 'char'

Code:

// Define namespace
namespace FreqPeriod {
extern volatile unsigned char f_capt;
extern volatile unsigned int capta;
extern volatile unsigned long captd;
extern volatile int ocnt;
  void begin();
  unsigned long int getPeriod();
}

// Define global variables for IRQ functions
volatile unsigned char FreqPeriod::f_capt;              // THIS LINE CAUSES THE ERROR
volatile unsigned int FreqPeriod::capta;
volatile unsigned long int FreqPeriod::captd;
volatile int FreqPeriod::ocnt;
...

...

I have realized, that there are generally syntax changes with the new IDE but would be have to have an explanation/solution for the above problem.

The error message is missing.

I have realized, that there are generally syntax changes with the new IDE

Where did you read that ?

Added to a bare minimum sketch your code snippet compiles for me
IDE 1.8.10
Nano board
Windows 10

Which version of the IDE, board and OS are you using ?

Post the whole code. When posting snippets, the problem is often in the part not posted.

Post the entire error message. It is easy to do. There is a copy error message button in the IDE. Copy the error and paste in a post in code tags. Paraphrasing the error message leaves out important information.

Thanks for your replies !

I found the problem, there was
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

further below in my code.
As my code is now some years old I can't remember the reason for that fragment, but by removing it my old program compiles.

Problem solved !
Thanks again !

BTW: The Error message was: expected initializer before 'char' given in my first post...

The complete error message would include the line number, character position and file as well.

lichti:
BTW: The Error message was: expected initializer before ‘char’ given in my first post…

BTW there was more of it than that.
You could have posted the actual error message.

lichti:
I have realized, that there are generally syntax changes with the new IDE but would be have to have an explanation/solution for the above problem.

What you discovered was not a "syntax" change. The language is C/C++ so unless the standard changes the syntax will not change.