Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Compile failure... (Read 426 times)
davidml
Junior Member
**
Offline



Posts: 13
Compile failure...
Jun 27th, 2020 at 12:21pm
 
I have used Visual Micro for Atmel Studio 7 for a bunch of years now and just recently started getting compile errors when compiling for ATmega328PB boards.  It doesn't matter which clock I choose (Internal Clock, External Clock or Crystal Clock) I get the same compile error.  It compiles fine when I choose Arduino Nano.  This just started happening and I can't figure out what changed. 

I have narrowed it down to a very simple program:

Code (C++):
#include <EEPROM.h>
#define GREEN_LED A1

void setup() {
  pinMode(GREEN_LED,OUTPUT);
  for (int i=0;i<1024;i++){
    EEPROM.update(i,255);
  }
}

void loop() {
  digitalWrite(GREEN_LED,HIGH);
  delay(1000);
  digitalWrite(GREEN_LED,LOW);
  delay(1000);
}

and I get the error

Compiling debug version of 'EEPROMErase' for 'ATmega328PB Internal Clock'
Build Folder: "file:///C:/Users/lehrian/AppData/Local/Temp/VMBuilds/EEPROMErase/m328pb_atmega328pbic/Debug"
Additional Defines: VM_DEBUGGER_TYPE_HARDWARESERIAL 0;VM_DEBUGGER_TYPE_SOFTWARESERIAL 1;VM_DEBUGGER_TYPE_FASTSERIAL 2;VM_DEBUGGER_TYPE_USB 3;VM_DEBUGGER_TYPE_TEENSY 4;VM_DEBUGGER_TYPE_UART 5;VM_DEBUGGER_TYPE_USART 6;VM_DEBUGGER_TYPE_USBSERIAL 7;VM_DEBUGGER_TYPE_TTYUART 8;VM_DEBUGGER_TYPE_NET_CONSOLE 9;VM_DEBUGGER_TYPE_Uart 10;VM_DEBUGGER_TYPE_COSA 11;VM_DEBUGGER_TYPE_CDCSerialClass 12;VM_DEBUGGER_TYPE_HARDWARESERIAL1 13;VM_DEBUGGER_TYPE_HARDWARESERIAL2 14;VM_DEBUGGER_TYPE_HARDWARESERIAL3 15;VM_DEBUGGER_TYPE_NET_UDP 16;VM_DEBUGGER_TYPE_USBAPI 17;VM_DEBUGGER_TYPE_SERIALUSB 18;VM_DEBUGGER_TYPE_MS430_SERIAL_ 19;VM_DEBUGGER_TYPE_NO_SERIAL 20;VM_DEBUGGER_TYPE_GENERIC_OBJECT 21;VM_DEBUG_ENABLE 1;VM_DEBUG;VM_DEBUG_BANDWIDTH_THROTTLE_MS 33;VM_DEBUGGER_SOFT_TRANSPORT Serial;VM_DEBUGGER_SOFT_TRANSPORT_WRITER Serial;VM_DEBUGGER_TYPE VM_DEBUGGER_TYPE_GENERIC_OBJECT;VM_DEBUG_BREAKPAUSE;
Architecture Tools: "file:///C:/Users/lehrian/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/"
Api: 1.2020.0321-2
Sketch Book: "file:///C:/Users/lehrian/Documents/Arduino"
Sketch Include Paths
Core Include Paths
Include Path "file:///C:/Program%20Files%20(x86)/Arduino/hardware/arduino/avr/cores/arduino"
Include Path "file:///C:/Users/lehrian/AppData/Local/arduino15/packages/m328pb/hardware/avr/1.1.4/variants/atmega328pb"

Deep search for libraries ...
"C:\Users\lehrian\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\bin\avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328pb -DVM_DEBUG_BREAKPAUSE -DVM_DEBUGGER_TYPE=VM_DEBUGGER_TYPE_GENERIC_OBJECT -DVM_DEBUGGER_SOFT_TRANSPORT_WRITER=Serial -DVM_DEBUGGER_SOFT_TRANSPORT=Serial -DVM_DEBUG_BANDWIDTH_THROTTLE_MS=33 -DVM_DEBUG -DVM_DEBUG_ENABLE=1 -DVM_DEBUGGER_TYPE_GENERIC_OBJECT=21 -DVM_DEBUGGER_TYPE_NO_SERIAL=20 -DVM_DEBUGGER_TYPE_MS430_SERIAL_=19 -DVM_DEBUGGER_TYPE_SERIALUSB=18 -DVM_DEBUGGER_TYPE_USBAPI=17 -DVM_DEBUGGER_TYPE_NET_UDP=16 -DVM_DEBUGGER_TYPE_HARDWARESERIAL3=15 -DVM_DEBUGGER_TYPE_HARDWARESERIAL2=14 -DVM_DEBUGGER_TYPE_HARDWARESERIAL1=13 -DVM_DEBUGGER_TYPE_CDCSerialClass=12 -DVM_DEBUGGER_TYPE_COSA=11 -DVM_DEBUGGER_TYPE_Uart=10 -DVM_DEBUGGER_TYPE_NET_CONSOLE=9 -DVM_DEBUGGER_TYPE_TTYUART=8 -DVM_DEBUGGER_TYPE_USBSERIAL=7 -DVM_DEBUGGER_TYPE_USART=6 -DVM_DEBUGGER_TYPE_UART=5 -DVM_DEBUGGER_TYPE_TEENSY=4 -DVM_DEBUGGER_TYPE_USB=3 -DVM_DEBUGGER_TYPE_FASTSERIAL=2 -DVM_DEBUGGER_TYPE_SOFTWARESERIAL=1 -DVM_DEBUGGER_TYPE_HARDWARESERIAL=0   -DF_CPU=8000000L -DARDUINO=108012 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Users\lehrian\AppData\Local\arduino15\packages\m328pb\hardware\avr\1.1.4\variants\atmega328pb" "C:\Users\lehrian\AppData\Local\Temp\VMBuilds\EEPROMErase\m328pb_atmega328pbic\Debug\EEPROMErase.cpp" -o "nul"
"C:\Users\lehrian\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\bin\avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328pb -DVM_DEBUG_BREAKPAUSE -DVM_DEBUGGER_TYPE=VM_DEBUGGER_TYPE_GENERIC_OBJECT -DVM_DEBUGGER_SOFT_TRANSPORT_WRITER=Serial -DVM_DEBUGGER_SOFT_TRANSPORT=Serial -DVM_DEBUG_BANDWIDTH_THROTTLE_MS=33 -DVM_DEBUG -DVM_DEBUG_ENABLE=1 -DVM_DEBUGGER_TYPE_GENERIC_OBJECT=21 -DVM_DEBUGGER_TYPE_NO_SERIAL=20 -DVM_DEBUGGER_TYPE_MS430_SERIAL_=19 -DVM_DEBUGGER_TYPE_SERIALUSB=18 -DVM_DEBUGGER_TYPE_USBAPI=17 -DVM_DEBUGGER_TYPE_NET_UDP=16 -DVM_DEBUGGER_TYPE_HARDWARESERIAL3=15 -DVM_DEBUGGER_TYPE_HARDWARESERIAL2=14 -DVM_DEBUGGER_TYPE_HARDWARESERIAL1=13 -DVM_DEBUGGER_TYPE_CDCSerialClass=12 -DVM_DEBUGGER_TYPE_COSA=11 -DVM_DEBUGGER_TYPE_Uart=10 -DVM_DEBUGGER_TYPE_NET_CONSOLE=9 -DVM_DEBUGGER_TYPE_TTYUART=8 -DVM_DEBUGGER_TYPE_USBSERIAL=7 -DVM_DEBUGGER_TYPE_USART=6 -DVM_DEBUGGER_TYPE_UART=5 -DVM_DEBUGGER_TYPE_TEENSY=4 -DVM_DEBUGGER_TYPE_USB=3 -DVM_DEBUGGER_TYPE_FASTSERIAL=2 -DVM_DEBUGGER_TYPE_SOFTWARESERIAL=1 -DVM_DEBUGGER_TYPE_HARDWARESERIAL=0   -DF_CPU=8000000L -DARDUINO=108012 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Users\lehrian\AppData\Local\arduino15\packages\m328pb\hardware\avr\1.1.4\variants\atmega328pb" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\owv4b5ex.iqe\Micro Platforms\default\debuggers\VM_DBG" "C:\Users\lehrian\AppData\Local\Temp\VMBuilds\EEPROMErase\m328pb_atmega328pbic\Debug\EEPROMErase.cpp" -o "nul"
"C:\Users\lehrian\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\bin\avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328pb -DVM_DEBUG_BREAKPAUSE -DVM_DEBUGGER_TYPE=VM_DEBUGGER_TYPE_GENERIC_OBJECT -DVM_DEBUGGER_SOFT_TRANSPORT_WRITER=Serial -DVM_DEBUGGER_SOFT_TRANSPORT=Serial -DVM_DEBUG_BANDWIDTH_THROTTLE_MS=33 -DVM_DEBUG -DVM_DEBUG_ENABLE=1 -DVM_DEBUGGER_TYPE_GENERIC_OBJECT=21 -DVM_DEBUGGER_TYPE_NO_SERIAL=20 -DVM_DEBUGGER_TYPE_MS430_SERIAL_=19 -DVM_DEBUGGER_TYPE_SERIALUSB=18 -DVM_DEBUGGER_TYPE_USBAPI=17 -DVM_DEBUGGER_TYPE_NET_UDP=16 -DVM_DEBUGGER_TYPE_HARDWARESERIAL3=15 -DVM_DEBUGGER_TYPE_HARDWARESERIAL2=14 -DVM_DEBUGGER_TYPE_HARDWARESERIAL1=13 -DVM_DEBUGGER_TYPE_CDCSerialClass=12 -DVM_DEBUGGER_TYPE_COSA=11 -DVM_DEBUGGER_TYPE_Uart=10 -DVM_DEBUGGER_TYPE_NET_CONSOLE=9 -DVM_DEBUGGER_TYPE_TTYUART=8 -DVM_DEBUGGER_TYPE_USBSERIAL=7 -DVM_DEBUGGER_TYPE_USART=6 -DVM_DEBUGGER_TYPE_UART=5 -DVM_DEBUGGER_TYPE_TEENSY=4 -DVM_DEBUGGER_TYPE_USB=3 -DVM_DEBUGGER_TYPE_FASTSERIAL=2 -DVM_DEBUGGER_TYPE_SOFTWARESERIAL=1 -DVM_DEBUGGER_TYPE_HARDWARESERIAL=0   -DF_CPU=8000000L -DARDUINO=108012 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Users\lehrian\AppData\Local\arduino15\packages\m328pb\hardware\avr\1.1.4\variants\atmega328pb" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\owv4b5ex.iqe\Micro Platforms\default\debuggers\VM_DBG" "C:\Users\lehrian\AppData\Local\Temp\VMBuilds\EEPROMErase\m328pb_atmega328pbic\Debug\EEPROMErase.cpp" -o "nul"

EEPROMErase.ino: 1:10: fatal error: EEPROM.h: No such file or directory
   #include <EEPROM.h>
   ^~~~~~~~~~
   compilation terminated
Debug build failed for project 'EEPROMErase' 



If I look at the directories under Toolchain it is missing the C:/Users/xxxxx/AppData/Local/arduino15/packages/arduino/hardware/avr/1.8.2/libra
ries/EEPROM/src
library which is present when I choose Nano. 

The file compiles correctly for the 328PB via Arduino IDE. 

I have tried uninstalling Visual Micro and Atmel Studio 7 and reinstalling it more than once and I have tried going back to an older version of Visual Micro from Nov 2019 and it didn't make any difference.  I am completely stumped at this point.  Any help would be appreciated. 
Back to top
« Last Edit: Jun 27th, 2020 at 1:53pm by Visual Micro »  

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



Posts: 10895
United Kingdom
Re: Compile failure...
Reply #1 - Jun 27th, 2020 at 1:52pm
 
The arduino ide comes with the avr toolchain and I suspect it is a slightly different version that you have in board manager.

As a test please try switching "vMicro>IDE" to the "No IDE" option so that Visual Micro uses just what you have installed via board manager.

Also provide verbose output from the arduino ide (file>prefs) and also say where or what package you have installed for your variation of the 328.

Finally, there is an update waiting for AS7 but Microchip are slow to publish. It is available here https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
davidml
Junior Member
**
Offline



Posts: 13
Re: Compile failure...
Reply #2 - Jun 27th, 2020 at 5:57pm
 
Thanks for the quick response! 

So I tried changing vMicro->IDE from Arduinoi 1.6/1.8 to Visual Micro (No IDE) and I could see that in Toolchain->Directories

C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino

changed to

C:/Users/lehrian/AppData/Local/arduino15/packages/arduino/hardware/avr/1.8.2/cor
es/arduino

but

C:/Users/lehrian/AppData/Local/arduino15/packages/arduino/hardware/avr/1.8.2/lib
raries/EEPROM/src

was still missing so it still failed to build. 

I have attached the verbose build output from Arduino IDE. 

I had found that latest version of the Visual Studio, but it actually gives me a compilation error when it is set to Arduino Nano so I reverted back to 3/21/2020 version.  I can provide you with the error I get with the newer version, but I don't want to complicate issues unless you think it will help. 

Hmmm, doesn't look like I can attach a file to a reply and the output is too large to include inline.  I will try to edit the original post and attach it to there.  If not I'll email it.
Back to top
 
 
IP Logged
 
davidml
Junior Member
**
Offline



Posts: 13
Re: Compile failure...
Reply #3 - Jun 27th, 2020 at 6:15pm
 
So a little more information.  It only seems to fail like this when I attempt to include any of the Arduino base libraries (EEPROM and SoftwareSerial are two that fail).  If I include a lib that I installed via the Library Manager it seems to work (for example MCP7940 real time clock library).
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10895
United Kingdom
Re: Compile failure...
Reply #4 - Jun 27th, 2020 at 9:02pm
 
Thanks for all the info. You have to click the Reply button to attach a file. The quick reply often doesn't allow it easpecially if the toolbar has a "Refresh Session" tab. If so click it and things will work better.

If the problem happens with arduino nano please give build output for visual micro as before. Otherwise please say how to install the core you are using for the custom 328 board.

Thanks
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
davidml
Junior Member
**
Offline



Posts: 13
Re: Compile failure...
Reply #5 - Jun 28th, 2020 at 9:39pm
 
As I was going through the steps to tell you how I installed the ATmega328PB board (which is via the Arduino IDE Tools->Board->Boards Manager and search for "ATmega328PB Boards" and the only option is "ATmega328PB Boards" by Watterott electronic version 1.1.4), it said that there were some updates for the Arduino boards and some Adafruit Boards so I updated them (no update for ATmega328PB) and a couple of unrelated libraries (Adafruit NeoPixel, Arduino Json, MCP7940 and RTClib).  I then went into Atmel Studio and did a compile to confirm the error and just a quickly as it stopped working, it started working again.  I no longer get the original error I reported when compiling with the ATMega328PB.  I switched to the Arduino Nano and it complied just fine as well.  This is using Visual Micro 20.3.21.2.

I then updated to the latest version of Visual Micro 20.06.18.0 for Atmel Studio 7 and got the other error of which I spoke.  It happened for both the Nano and 328PB (I didn't notice I got the error for the 328PB the other night because it never made it that far in the compile process).  I do remember coming across another post on this forum where it mentioned something about prototype method definitions.  So I removed my prototype definitions at the top of my .ino file and it now compiles fine for both 328PB and Nano. 

So, he says sheepishly, I don't know why it mysteriously stopped working and just as mysteriously started working again.  I am going to have to write it off to the Arduino board definition update as that is the only thing that changed.  As the ATmega328PB doesn't provide an EEPROM library, it uses the one that comes with the Arduino since it is essentially the same processor as the Arduino Nano (328P) with a second UART and another set of ports, I'm guessing the reinstallation during the update fixed my error.  Or maybe I was never getting the error in the first place and imagined all of this... Tongue
Back to top
« Last Edit: Jun 28th, 2020 at 9:41pm by davidml »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10895
United Kingdom
Re: Compile failure...
Reply #6 - Jun 28th, 2020 at 9:45pm
 
Thanks for the update but your own .ino prototypes shouldn't cause it to fail. It would be useful to have an example of the source with it failing. Even if only with one or two prototypes. Code doesn't have to do anything, just fail to compile.

Thanks again.
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
davidml
Junior Member
**
Offline



Posts: 13
Re: Compile failure...
Reply #7 - Jun 28th, 2020 at 10:46pm
 
It seems that the issue is caused if there is a prototype definition for setup() AND loop().  If I remove either of these then the error goes away.  Attached is the error I get when both of these prototypes are included.  For an additional test I added a void test(); and its associated method and it has no impact.  It seems it is fickle about setup(); and loop(); specifically. 

void setup();
void loop();

void setup()
{
       /* add setup code here, setup code runs once when the processor starts */
}

void loop()
{
       /* add main program code here, this code starts again each time it ends */
}

Attached is the build error.
Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print