Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Macro __AVR_ATmega2560__ not recognised (Read 2552 times)
Henk Levels
Junior Member
**
Offline


Posts: 81
Joined: Sep 28th, 2015
Macro __AVR_ATmega2560__ not recognised
Mar 19th, 2024 at 8:39am
Print Post  
Hi,

See attachment below. why is the code section with the if defined __AVR_ATmega2560__ not recognised while the board Mega2560 is selected.
When I remove the comments at #define __AVR_ATmega2560__ it is recognised. But that is not desirable
By the way. I use VS 2022 on a Win 10 computer
What must I do to solve this
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2766
Joined: Feb 13th, 2019
Re: Macro __AVR_ATmega2560__ not recognised
Reply #1 - Mar 19th, 2024 at 9:55am
Print Post  
Please follow the instructions at the top of the page, and attach the full build output as a text file for us to review.
  
Back to top
IP Logged
 
Henk Levels
Junior Member
**
Offline


Posts: 81
Joined: Sep 28th, 2015
Re: Macro __AVR_ATmega2560__ not recognised
Reply #2 - Mar 19th, 2024 at 10:21am
Print Post  
Hi,

see attached the build file with show build properties on.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2766
Joined: Feb 13th, 2019
Re: Macro __AVR_ATmega2560__ not recognised
Reply #3 - Mar 19th, 2024 at 10:28am
Print Post  
Thanks, the file attached seems to be the build folder contents, which is not what we need.

Can you perform a build on your project, and then copy the entire text from the Output > Micro Build window, and attach this as a text file?
  
Back to top
IP Logged
 
Henk Levels
Junior Member
**
Offline


Posts: 81
Joined: Sep 28th, 2015
Re: Macro __AVR_ATmega2560__ not recognised
Reply #4 - Mar 19th, 2024 at 10:38am
Print Post  
Hi,

see attached text file. Hopefully this is a correct one.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2766
Joined: Feb 13th, 2019
Re: Macro __AVR_ATmega2560__ not recognised
Reply #5 - Mar 19th, 2024 at 11:01am
Print Post  
Thanks for the log, it seems the project is using the old Intellisense System.

Can you try upgrading it as shown on the below page:
https://www.visualmicro.com/page/Upgraded-Intellisense-System-in-Visual-Micro.as...
  
Back to top
IP Logged
 
Henk Levels
Junior Member
**
Offline


Posts: 81
Joined: Sep 28th, 2015
Re: Macro __AVR_ATmega2560__ not recognised
Reply #6 - Mar 19th, 2024 at 11:51am
Print Post  
Hi,

I followed the steps to install the latest intellisense.
I got the message conversion completed succesfully.
I quit VS2022 and restarted and loaded the project again.
However the problem still remains when selecting the Mega2560 as board.
The Atmega328 keeps selected and not the Mega2560
What to do next?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2766
Joined: Feb 13th, 2019
Re: Macro __AVR_ATmega2560__ not recognised
Reply #7 - Mar 19th, 2024 at 11:55am
Print Post  
Do you have an ATMega328 plugged in to your PC, with the vMicro > General > Auto Select a Board/Port When A Device Connects Enabled?

If so please disable the Auto Board selection option and it should then allow the ATMega2560 to stay selected.
  
Back to top
IP Logged
 
Henk Levels
Junior Member
**
Offline


Posts: 81
Joined: Sep 28th, 2015
Re: Macro __AVR_ATmega2560__ not recognised
Reply #8 - Mar 19th, 2024 at 12:22pm
Print Post  
Hi Simon,

I have a Mega2560 connected to my PC.
Switching on or off the vMicro > General > Auto Select a Board/Port does not make any difference.
When I remove the comment from #define __AVR_ATmega2560__ see also my first screenshot, it works
« Last Edit: Mar 19th, 2024 at 12:24pm by Henk Levels »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2766
Joined: Feb 13th, 2019
Re: Macro __AVR_ATmega2560__ not recognised
Reply #9 - Mar 19th, 2024 at 12:23pm
Print Post  
If you have the setting disabled, and then select the ATMega2560 board, does the ATMega2560 stay selected?
  
Back to top
IP Logged
 
Henk Levels
Junior Member
**
Offline


Posts: 81
Joined: Sep 28th, 2015
Re: Macro __AVR_ATmega2560__ not recognised
Reply #10 - Mar 19th, 2024 at 12:36pm
Print Post  
The ATMega2560 board stays selected, but the code is not highlighted.
See new screenshot attached
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2766
Joined: Feb 13th, 2019
Re: Macro __AVR_ATmega2560__ not recognised
Reply #11 - Mar 19th, 2024 at 2:06pm
Print Post  
Thanks for the update.

Can you send the screenshot including with the Solution Explorer visible, just so we can understand the layout of the project and the library code file showing the error?

Can you also confirm how you navigated to the CPP file where the #define doesn't work?
  
Back to top
IP Logged
 
Henk Levels
Junior Member
**
Offline


Posts: 81
Joined: Sep 28th, 2015
Re: Macro __AVR_ATmega2560__ not recognised
Reply #12 - Mar 19th, 2024 at 4:58pm
Print Post  
Hi,

See attached screenshot with the ino file.
By clicking on the tab with the cpp file I get the view like I did sent before, where the atmega2560 code is not activated.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2766
Joined: Feb 13th, 2019
Re: Macro __AVR_ATmega2560__ not recognised
Reply #13 - Mar 19th, 2024 at 5:04pm
Print Post  
Thanks for the update.  Did you open the CPP file by using the File > Open File Dialogue in VS?

If you click on vMicro > Show/Hide Hidden Files, this will reveal all library sources in the Solution Explorer.  If you close the CPP/H for the library and then re-open them from the Solution Explorer listing the intellisense should be better.
  
Back to top
IP Logged
 
Henk Levels
Junior Member
**
Offline


Posts: 81
Joined: Sep 28th, 2015
Re: Macro __AVR_ATmega2560__ not recognised
Reply #14 - Mar 19th, 2024 at 5:23pm
Print Post  
Thank Simon.

That does the job. Now it is working.
I never should have found it this way
Thanks a lot.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint