Start a new topic

Error: macro names must be identifiers


I have followed a tutorial from YouTube but he is using the Arduino Mega and I'm using the Leonardo Arduino so I have disabled the dbSerial but it sends me an error :
"[name of the program] 2:9: error: macro names must be identifiers"

I had to define the "NexConfig.h" to disable the db from the file. 
I have linked the code if you wanna check it. 
I hope someone has the solution to my problem. 
Thank you for reading. 

PS: Here is the link of the tutorial that I have followed ""
(871 Bytes)

Please refer to your Hardware Documentation

Please ensure the Iteadlib Arduino Nextion Library is installed

A Leonardo has Serial and Serial1

Therefore you should edit your NexConfig.h file

 - this will be located in your Arduino folders in Documents

Please refer to and your Leonardo documentation

 - on use of what #define means

   such incorrect usage creates an error

   - as such remove line 2 from your script

Edits to your NexConfig.h file, please ensure


#define dbSerial Serial

#define nexSerial Serial1

Once this is done you should be able to remove line 38


By configuration Serial will be used for Serial Monitor

and Serial1 will be used for Nextion communications

Hello Patrick, 

Thank you for this answer, I have done everything that you have said but it sends me new errors:

"In file included from U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp:16:

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\/NexUpload.h:133: error: 'File' does not name a type

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp: In member function 'bool NexUpload::_checkFile()':

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp:91: error: 'SD' was not declared in this scope

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp:96: error: 'SD' was not declared in this scope

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp:100: error: '_myFile' was not declared in this scope

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp:100: error: 'SD' was not declared in this scope

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp: In member function 'bool NexUpload::_downloadTftFile()':

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp:210: error: '_myFile' was not declared in this scope

U:\Arduino\libraries\ITEADLIBArduinoNextionmaster\NexUpload.cpp:224: error: '_myFile' was not declared in this scope"

I don't know what this error means, could you help me once again if possible ? 

Thank you

delete for now, the two files NexUpload.h and NexUpload.cpp

Ah It works thank you so much ! 

Glad to hear.  Happy Coding

1 person likes this

Some days ago the program worked and the number increased or decreased it depended which button I have pressed but now It doesn't work when I press on buttonPlus or buttonMoins the number doesn't change, it still 50 on my screen.

I checked the serial monitor on the arduino it sends me this message every time I release/push (depend which button) a button "recvRetCommandFinished err " I don't know what this message mean.

Could you help me if possible.

rather than analyzing the error you should think more on what you exactly did between "working" and "not working" ...

in general, nothing happens without a reason ... software wont change by itself, so there must have been an user interaction for this ...

I am agree with you but I don't remember to change something between yesterday and today. 

I just have followed the steps from Patrick then the program worked I could push/release the button it will increase/decrease the textnumber and now I retry and It doesn't work I don't even how

Have you restarted both Nextion and MCU?

Yes I have done this, I have verified the NexConfig.h , each lines of the Arduino code and check if each buttons was correctly set up (component id etc...) 

Double check all is common ground?  Loose wire?

Oh I found what was the problem, the last day I missclicked I have deleted the text component so I replaced it and I forget to rename It.... 
I'm sorry for the trouble! 
And thank you for your answers :) 

Login or Signup to post a comment