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) Atmel Studio, Error messages cannot correspond to line numbers. (Read 12759 times)
Sam6
Junior Member
**
Offline


Posts: 21
Joined: Mar 22nd, 2013
Atmel Studio, Error messages cannot correspond to line numbers.
Feb 9th, 2014 at 4:18am
Print Post  
I'm using the Current and fully updated version of Atmel Studio. I have noticed, if an error is generated while compiling, The line numbers given by the error message is always 7 lines higher than the actual line number where the problem exist. At first it was kind of confusing because I did not find the error where it was supposed to be. Now that I realize the problem I can quickly find the error. But it is still kind of annoying.

Is it just me, or has anyone else come across this problem.

Thank you.

Joe.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #1 - Feb 9th, 2014 at 2:49pm
Print Post  
Hi,

No this isn't normal can you please confirm the following:-

1) Atmel Version from Help>About
2) Is this a debug compile that fails or normal?
3) Is the error in a .ino/.cpp/.h?

If you switched the project property "Validation Skip" to True then please set it back to false.

Please email your sketch to info [at] visualmicro.com including any sub folders. Thanks
  
Back to top
IP Logged
 
Sam6
Junior Member
**
Offline


Posts: 21
Joined: Mar 22nd, 2013
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #2 - Feb 10th, 2014 at 1:44am
Print Post  
Atmel Studio 6.1 2730 service pack2.

I opened a basic sketch "blinking".

I manufactured in error at the end of the sketch by adding a "}".

Compiled the sketch and got this error message.

Compiling 'Blink' for 'Arduino Due (Programming Port)'
Blink.ino:29: error: expected declaration before '}' token
Error compiling
"
since the sketch ends at line 25, I know that there's something wrong.

And no I have not altered the "Validation Skip" property. Where would I find it.


Thank you for your help.

Joe.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #3 - Feb 10th, 2014 at 12:41pm
Print Post  
Ok thanks. Please do not alter the validation skip I was just checking with you what your settings are  Smiley

What if you put an error in the code instead of a missing last } ??

If might actually be a bug if the very last line is reported to Visual Micro/Arduino as an error. Errors in all other lines will probably work okay?

  
Back to top
IP Logged
 
Sam6
Junior Member
**
Offline


Posts: 21
Joined: Mar 22nd, 2013
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #4 - Feb 10th, 2014 at 5:20pm
Print Post  
"if might actually be a bug if the very last line is reported to Visual Micro/Arduino as an error. Errors in all other lines will probably work okay?"Off

No, The problem persists no matter where the bug is in the code. It can be on the first line, on the last, or anywhere in between. It does not matter. I only use that example because it was very obvious something was wrong.
However I have noticed that the Error does change. Sometimes it is 5 lines off, and sometimes it is more. 

I appreciate any help you can give.

Thank you.

Joe.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #5 - Feb 10th, 2014 at 5:59pm
Print Post  
Hi Joe,

Thanks for the info. 

Are you double clicking the errors and does that take you to the wrong location?

Thanks

  
Back to top
IP Logged
 
Sam6
Junior Member
**
Offline


Posts: 21
Joined: Mar 22nd, 2013
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #6 - Feb 10th, 2014 at 9:57pm
Print Post  
Since I was always in the general area where the error would occur, I never tried it. I normally do one modification at a time. I went back to the "Blink" sketch and tried it. Although it is hard to tell on such a small sketch, it did tend to take me to the general area. But not the exact location. Although some errors are kind of ambiguous, and hard for the program to pinpoint exactly, specific errors such as missing semicolons, invalid variable names, and misspelled keywords, should be easy to spot for the program. In these cases the program did take me to the exact line number.

Also, while investigating this problem I noticed something else. When I closed the program it asked me if I wanted to save the changes. I clicked no. I did not want to save the error. Yet the changes were saved to the "Blink.ino" anyway. When I reopened the file the error was still there. I had to make sure all the errors were clear and the sketch was running properly before I close the program. Normally when I close the program I want to save all changes, so this issue has not come up before.

I appreciate your assistance.

Joe.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #7 - Feb 10th, 2014 at 10:16pm
Print Post  
Hi,

1)
The error are returned from the gcc compiler and often include a few lines per error. The format of the error should be filename: linenumber and normally one of the error lines should take you to the expected "original" location.

Example: If you cause an error by breaking the word Serial.print("") into Ser ial.print("") does this give you a correct error?

2)
If you add a library the .ino will auto save but otherwise it should only save when you ask it to save
  
Back to top
IP Logged
 
Sam6
Junior Member
**
Offline


Posts: 21
Joined: Mar 22nd, 2013
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #8 - Feb 10th, 2014 at 10:48pm
Print Post  
I simulated that error, on a sketch that I'm working on.
Actual line number was "555".
Reported line number was "566".
When I double-click the error message it correctly took me to line number "555".

I also created a similar error in the "blink" sketch, with similar results.

The discrepancy seems to be in line numbers only. 

As far as the autosave function goes, no libraries were added.
I only had the file open for a short time, just enough to create an error and verify what was happening. When I exited the program, I click no I did not want to save the changes. But it saved it anyway. It is one thing to save the changes to a temporary file and then transfer it to the original file. But it should not alter the original file without your permission.

I appreciate your assistance.

Joe.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #9 - Feb 11th, 2014 at 12:45am
Print Post  
Oh sorry, I've just remembered that all versions of Visual Studio auto save prior to a build and you won't be seeing the errors unless you have done a build. The undo system is good but not if you have closed the system. Although there are some great free extensions for VS (not sure about atmel) that track source changes on the local machine.

It might be an option somewhere in the options but Visual Micro currently needs the sketch saved because it reads the sketch from the disk and ignores the project.

Interesting the line number shows wrong but it drill down to the correct location. That sounds like a bugette in the error reporting changes of the last release.

Thanks for the report.

ps: Did you try the xFeatures extension in Atmel Studio, color codes errors/warnings. Very nice
« Last Edit: Feb 11th, 2014 at 12:58am by Tim@Visual Micro »  
Back to top
IP Logged
 
Sam6
Junior Member
**
Offline


Posts: 21
Joined: Mar 22nd, 2013
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #10 - Feb 11th, 2014 at 2:52am
Print Post  
"ps: Did you try the xFeatures extension in Atmel Studio, color codes errors/warnings. Very nice "

Thanks for the information. I will take a look at that.

As far as the Autosave feature before the  build, that makes sense. But can I make a suggestion. In the future Versions, have it save the file to a Temporary File, instead of the main file. That way if something should go terribly wrong, you don't lose your previous work. 

Thank you for your help, And I hope this helps the program.
This platform is much better than the original Arduino IDE.
Sometimes it's the little bugs "mosquitoes" That annoys us the most.

Joe.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Atmel Studio, Error messages cannot correspond to line numbers.
Reply #11 - Feb 11th, 2014 at 3:20am
Print Post  
Thanks for the feed back it is always appreciated. I don't think we have any control over the save, it's a VS thing I am afraid
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint