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) Undefined Reference to 'main' and Id returned 1 exit status errors (Read 19026 times)
Kamil
Newbies
*
Offline


Posts: 6
Joined: Aug 29th, 2014
Undefined Reference to 'main' and Id returned 1 exit status errors
Aug 29th, 2014 at 5:15pm
Print Post  
Hey,
I am trying to use Atmel studio 6.1 in conjunction with Visual Micro to build and debug Arduino code.

However I am am having i keep getting the above stated errors. For some reason I believe Atmel is not using/recognizing the Arduino core libraries  Angry ??   

I have already added various directories via the "Toolchain" utility but no luck. I have also added symbols in the "Toolchain" utility.  

As of now I only have the regular setup() and loop() functions in the ino file, furthermore I have already checked the Ide-location for visual micro is correct. I am using Adruino 1.5.2 if that helps.


Thanks,
Kamil
« Last Edit: Aug 29th, 2014 at 6:13pm by Kamil »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Gilles Plante
Full Member
***
Offline


Posts: 156
Location: Québec, Canada
Joined: Oct 31st, 2013
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #1 - Aug 29th, 2014 at 6:00pm
Print Post  
Hi Kamil,

does the name of your sketch contains spaces, or in some way does not follow Arduino guidelines in naming sketches ? I ask because that produces this error.

@Tim

there is an image attached to  Kamil's question. Since a certain amount of time, when there is such a link, clicking on it brings to a page telling the name of the time to open. Usually pasting it in the browser works, but not that time  Huh.
  
Back to top
 
IP Logged
 
Kamil
Newbies
*
Offline


Posts: 6
Joined: Aug 29th, 2014
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #2 - Aug 29th, 2014 at 6:06pm
Print Post  
No on spaces or other problems.The ino file is called DataLoggerCanBus.ino ... 
« Last Edit: Aug 29th, 2014 at 6:14pm by Kamil »  
Back to top
 
IP Logged
 
Gilles Plante
Full Member
***
Offline


Posts: 156
Location: Québec, Canada
Joined: Oct 31st, 2013
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #3 - Aug 29th, 2014 at 6:17pm
Print Post  
If you try to compile in Arduino's IDE, do you get the same error message ?
  
Back to top
 
IP Logged
 
Kamil
Newbies
*
Offline


Posts: 6
Joined: Aug 29th, 2014
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #4 - Aug 29th, 2014 at 6:24pm
Print Post  
No I do not any errors, if I compile using the Arduino IDE. Furthermore I have the "Add New Sketch Item", "Upload Last Sketch Build" options disabled(grayed out). 

I have already checked the Add-in Manager. And Visual Micro is available and startup and command line boxes are checked.
  
Back to top
 
IP Logged
 
Gilles Plante
Full Member
***
Offline


Posts: 156
Location: Québec, Canada
Joined: Oct 31st, 2013
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #5 - Aug 29th, 2014 at 6:30pm
Print Post  
Then it's not an issue with the name of the sketch.

I will try to help until Tim comes in. I recall that it happens that users are mixed up with the two kinds of IDE: 1.0.5 for AVR CPUs and 1.5.x for other CPUs. In VisualMicro, there are two setups, one for each kind of IDEs. That may explain the issue.

I also suggest to change the compiler to verbose mode and capture the output from the compiler. I am pretty sure Tim will ask for that.
  
Back to top
 
IP Logged
 
Kamil
Newbies
*
Offline


Posts: 6
Joined: Aug 29th, 2014
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #6 - Aug 29th, 2014 at 6:36pm
Print Post  
Funny thing is my colleague who worked on a different Arduino project has that one working and compiling fine.  Only this project (I created a new one) is giving issues.   

Attached is the verbose compiler output:
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Gilles Plante
Full Member
***
Offline


Posts: 156
Location: Québec, Canada
Joined: Oct 31st, 2013
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #7 - Aug 29th, 2014 at 6:55pm
Print Post  
I never used the 1.5.x compiler unfortunately. One other thing you may do is to set the Arduino's IDE to verbose and then compare both outputs.

I don't know if spaces are also forbidden in 1.5.x sketches, but I see you have spaces in your project name (the name of your .elf file).

Tim will help you figure out what's going on  Smiley.
  
Back to top
 
IP Logged
 
Kamil
Newbies
*
Offline


Posts: 6
Joined: Aug 29th, 2014
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #8 - Aug 29th, 2014 at 7:57pm
Print Post  
Don't believe thats the issue. Because i made a new project named test and that too gave the same error.
  
Back to top
 
IP Logged
 
Gilles Plante
Full Member
***
Offline


Posts: 156
Location: Québec, Canada
Joined: Oct 31st, 2013
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #9 - Aug 29th, 2014 at 8:17pm
Print Post  
Well then, looks like VisualMicro is not able to use properly the IDE for some reason.
  
Back to top
 
IP Logged
 
Kamil
Newbies
*
Offline


Posts: 6
Joined: Aug 29th, 2014
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #10 - Aug 29th, 2014 at 8:46pm
Print Post  
After a lot of research and head scratching I added the core.a library found in the temp directory, created when  the Aurduino IDE compiles, to the toolchain linker option. 

This resulted in a cannot find -lcore error. Any ideas on this ?? 

I am using this website as a guide:
http://www.jayconsystems.com/tutorial/atmerpt2/
« Last Edit: Aug 29th, 2014 at 8:48pm by Kamil »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Undefined Reference to 'main' and Id returned 1 exit status errors
Reply #11 - Aug 29th, 2014 at 8:49pm
Print Post  
Hi Kamil

I think you have created an atmel make file project

The compiler output you see is what happens in atmel studio if visual micro is not active.

Visual Micro will go to sleep for make file projects Smiley

When visual micro manages a project it sets all of the avr/sam project properties and manages the libraries + compile.

To create or open an arduino project please follow the documentation guide here http://www.visualmicro.com/page/User-Guide.aspx?doc=index. ;

You will see that there are various easy ways to create a new arduino project using "file>new>sketch project" or "file>new>project" or "file>open>sketch>project"

I suggest you delete the cpporoj and solution then re-open or create a sketch using the documented commands. Visual micro

Thanks
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint