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
Normal Topic undefine reference to main error using Arduino sketch in Atmel studio 7 (Read 4381 times)
JJM57
Newbies
*
Offline


Posts: 2
Joined: Dec 26th, 2015
undefine reference to main error using Arduino sketch in Atmel studio 7
Dec 26th, 2015 at 5:15pm
Print Post  
Hi,
I am a newbie and I would like to use Atmel to write my code for the Arduino boards. I Start a new project using Arduino Sketch. It build a blank code as follow.
Code (C++)
Select All
/*
 * Blank_Practice.ino
 *
 * Created: 12/26/2015 11:39:05 AM
 * Author: John
 */

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 */

}
  


Before I add to the code I wanted to see if it builds with out error. When I build the code I get the following 2 errors.
undefined reference to main
Id returned 1 exit status.
I search on line for help and so far I have not found how to resolve it. Can someone tell me what I am missing I think there is something I do not have set up right.

Thanks
John
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: undefine reference to main error using Arduino sketch in Atmel studio 7
Reply #1 - Dec 26th, 2015 at 5:18pm
Print Post  
Hi,

Can you post the full compiler output after a build please

Thanks
  
Back to top
IP Logged
 
JJM57
Newbies
*
Offline


Posts: 2
Joined: Dec 26th, 2015
Re: undefine reference to main error using Arduino sketch in Atmel studio 7
Reply #2 - Dec 26th, 2015 at 5:52pm
Print Post  
------ Build started: Project: Blank Practice, Configuration: Debug AVR ------
Build started.
Project "Blank Practice.cppproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\Jody n John\Documents\Atmel Studio\7.0\Blank Practice\Blank Practice\Blank Practice.cppproj" (target "Build" depends on it):
     Task "RunCompilerTask"
           Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
           C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all 
           Building target: Blank Practice.elf
           Invoking: AVR8/GNU Linker : 4.9.2
           "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-g++.exe" -o "Blank Practice.elf"     -Wl,-Map="Blank Practice.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.0.91\gcc\dev\atmega328p"   
C:/Program Files atmega328p.o(1,1): error: undefined reference to `main'
collect2.exe(0,0): error: ld returned 1 exit status
           make: *** [Blank Practice.elf] Error 1
           The command exited with code 2.
     Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "Blank Practice.cppproj" -- FAILED.
Done building project "Blank Practice.cppproj" -- FAILED.

Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint