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 Error creating .elf Due (?) to the character "_" in file and variable names? (Read 8206 times)
STE
Newbies
*
Offline


Posts: 4
Joined: Oct 25th, 2014
Error creating .elf Due (?) to the character "_" in file and variable names?
Oct 25th, 2014 at 6:51pm
Print Post  
Hi:  I am using an arduino uno and have installed atmel studio 6, version 6.2.x.  I can build and upload the basic blink sketch, just fine. My problem is that I have an arduino sketch that uses an LCD with I2c.  Here is a link to the library. https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/LiquidCrystal_V1.2... My sketch has the following error, when I try to build it: Error creating .elf.  Based on what I read here, "Thanks, there used to be some code to handle that. maybe it is missing or maybe ignoring dashes." http://www.visualmicro.com/forums/YaBB.pl?num=1405331521/4 . I wonder if the problem is the inclusion of _ in the names of some folders, files, and variables?  I began to go through and change the names, but there are a lot of them with an _ in them. ( See attachment).  Instead, to try to test this, I removed the LCD I2C library and any LCD.print statements from my sketch.  I was now able to build and upload the sketch.
Thank you for your wonderful work.  
Steve
  

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


Posts: 12136
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error creating .elf Due (?) to the character "_" in file and variable names?
Reply #1 - Oct 25th, 2014 at 6:55pm
Print Post  
Hi,

I don't think the underscores are a problem.

Did you try compiling one of the examples that come with the library?

Thanks
  
Back to top
IP Logged
 
STE
Newbies
*
Offline


Posts: 4
Joined: Oct 25th, 2014
Re: Error creating .elf Due (?) to the character "_" in file and variable names?
Reply #2 - Oct 25th, 2014 at 9:27pm
Print Post  
I tried building sainlcdtest.ino, the example that comes with LiquidCrystal_I2C and got the same error: "Error creating .elf."  The attachment has the .ino file.

Here is the entire build message:

Compiling 'sainlcdtest' for 'Arduino Uno'
LCD.cpp.o:In function `LCD'
LCD.cpp:LCD()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:49: first defined here
LCD.cpp.o:In function `LCD'
LCD.cpp:LCD()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:49: first defined here
LCD.cpp.o:In function `LCD::backlight()'
LCD.cpp:backlight()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:301: first defined here
LCD.cpp.o:In function `LCD::noBacklight()'
LCD.cpp:noBacklight()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:308: first defined here
LCD.cpp.o:In function `LCD::command(unsigned char)'
LCD.cpp:command(unsigned char)'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:331: first defined here
LCD.cpp.o:In function `LCD::noAutoscroll()'
LCD.cpp:noAutoscroll()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:278: first defined here
LCD.cpp.o:In function `LCD::autoscroll()'
LCD.cpp:autoscroll()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:271: first defined here
LCD.cpp.o:In function `LCD::moveCursorLeft()'
LCD.cpp:moveCursorLeft()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:266: first defined here
LCD.cpp.o:In function `LCD::moveCursorRight()'
LCD.cpp:moveCursorRight()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:260: first defined here
LCD.cpp.o:In function `LCD::rightToLeft()'
LCD.cpp:rightToLeft()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:251: first defined here
LCD.cpp.o:In function `LCD::leftToRight()'
LCD.cpp:leftToRight()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:244: first defined here
LCD.cpp.o:In function `LCD::scrollDisplayRight()'
LCD.cpp:scrollDisplayRight()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:240: first defined here
LCD.cpp.o:In function `LCD::scrollDisplayLeft()'
LCD.cpp:scrollDisplayLeft()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:235: first defined here
LCD.cpp.o:In function `LCD::blink()'
LCD.cpp:blink()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:226: first defined here
LCD.cpp.o:In function `LCD::noBlink()'
LCD.cpp:noBlink()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:220: first defined here
LCD.cpp.o:In function `LCD::cursor()'
LCD.cpp:cursor()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:213: first defined here
LCD.cpp.o:In function `LCD::noCursor()'
LCD.cpp:noCursor()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:208: first defined here
LCD.cpp.o:In function `LCD::display()'
LCD.cpp:display()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:201: first defined here
LCD.cpp.o:In function `LCD:Shockedn()'
LCD.cpp:on()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:315: first defined here
LCD.cpp.o:In function `LCD::noDisplay()'
LCD.cpp:noDisplay()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:195: first defined here
LCD.cpp.o:In function `LCD:Shockedff()'
LCD.cpp:off()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:323: first defined here
LCD.cpp.o:In function `LCD::setCursor(unsigned char, unsigned char)'
LCD.cpp:setCursor(unsigned char, unsigned char)'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:171: first defined here
LCD.cpp.o:In function `LCD::write(unsigned char)'
LCD.cpp:write(unsigned char)'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:342: first defined here
LCD.cpp.o:In function `LCD::createChar(unsigned char, unsigned char*)'
LCD.cpp:createChar(unsigned char, unsigned char*)'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:285: first defined here
LCD.cpp.o:In function `LCD::home()'
LCD.cpp:home()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:167: first defined here
LCD.cpp.o:In function `LCD::clear()'
LCD.cpp:clear()'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:161: first defined here
LCD.cpp.o:In function `LCD::begin(unsigned char, unsigned char, unsigned char)'
LCD.cpp:begin(unsigned char, unsigned char, unsigned char)'
LCD.cpp.o:C:\Program Files (x86)\Arduino\libraries\LCD\LCD.cpp:76: first defined here
Error creating .elf

Thanks,
Steve
  

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


Posts: 12136
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error creating .elf Due (?) to the character "_" in file and variable names?
Reply #3 - Oct 26th, 2014 at 10:36am
Print Post  
Hi,

I can't see that example in the link that you provided.

I also suggest putting the libraries that you install in documents/arduino/libraries

documents/arduino is the default SketchBook folder for arduino unless you have changed it in the config screens.

  
Back to top
IP Logged
 
STE
Newbies
*
Offline


Posts: 4
Joined: Oct 25th, 2014
Re: Error creating .elf Due (?) to the character "_" in file and variable names?
Reply #4 - Oct 26th, 2014 at 5:28pm
Print Post  
Hello:

My sketch is in: C:\Users\se\Documents\Arduino\examples\LiquidCrystal_I2C\sainlcdtest

My library is in: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal_I2C

The library is here: https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
And I am using: LiquidCrystal_V1.2.1.zip

The sketch/example is based on the one here: https://bitbucket.org/celem/sainsmart-i2c-lcd/src/3adf8e0d2443/sainlcdtest.ino

Here is my modified sketch that still gives the .elf error.
//////////////////////////
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
///////////////////////
#define I2C_ADDR    0x3F  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7
int n = 1;
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
//  lcd.begin (20,4);  
  lcd.begin (16,2);  
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  //lcd.home ();                   // go home
  //lcd.print("1234567890123456");  
  lcd.setCursor ( 0, 1 );        // go to the 2nd line
  lcd.print("abcdefghijklmnoqprst");
  lcd.setCursor ( 0, 2 );        // go to the third line
  lcd.print("1234567890123456");
}

void loop()
{
  lcd.setCursor (1,0);        
  lcd.print(n++,DEC);
//  lcd.setCursor (1,1);        
//  lcd.print("st");  
  delay(50);
}

Thank you so much, Steve
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12136
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error creating .elf Due (?) to the character "_" in file and variable names?
Reply #5 - Oct 26th, 2014 at 5:56pm
Print Post  
Hi,

For you info there are usually "official" examples in a sub folder called "examples" within the library folder. I obviously looked in the LiquidCrystal_V1.2.1.zip for the examples.

I suspect that you will have this issue in both the Arduino Ide and in Visual Micro. The problem is a weakness in the Arduino library design although strengthened recently.

Notice that paths are not specified in the arduino #include syntax. This is the root of the issue because there is a library that installs with arduino called LCD and it contains an LCD.h. So how do we work out which lib to use?

Historically this could always be an issue although if you had installed the _I2C library in the sketch book and not under the main arduino ide folder you might not have hit the issue. This is because the sketch book libraries are loaded prior to the ide libraries and as such resolve first when hunting through internal library hash tables. As I said it's a weakness of the arduino design.

You can probably force the issue to be correct by switching the order of the #includes so that the _I2C library and it's associated files are discovered first.

Code
Select All
#include <LiquidCrystal_I2C.h>
#include <LCD.h> 



Alternatively Visual Micro allows you to do something that the Arduino ide does not support by including the library name before each #include 

Code
Select All
#include <LiquidCrystal_I2C/LiquidCrystal_I2C.h>
#include <LiquidCrystal_I2C/LCD.h> 



Finally you could also move the LCD library from arduinoide/libraries so that it is not discovered. 

The best advise for library authors is NOT to use file names that exist in other Arduino libraries  Angry
« Last Edit: Oct 26th, 2014 at 5:58pm by Tim@Visual Micro »  
Back to top
IP Logged
 
STE
Newbies
*
Offline


Posts: 4
Joined: Oct 25th, 2014
Re: Error creating .elf Due (?) to the character "_" in file and variable names?
Reply #6 - Oct 26th, 2014 at 8:40pm
Print Post  
It works now with this which is just great!

#include <LiquidCrystal_I2C/LiquidCrystal_I2C.h>
#include <LiquidCrystal_I2C/LCD.h>

Thanks.  

Now,  the following is not printing to the LCD, even though printString1 and 2 have the right stuff in them.

  // print to LCD
  lcd.setCursor (0,0);  // first row
  lcd.print(printString1);
  lcd.setCursor (0,1);  // second row
  lcd.print(printString2);  

Is there anyway to use visual micro to figure out why the above is not printing?  Is there a way to check memory or SRAM usage.  I have seen stuff written about Serial.print using too much memory?

Thank you,
Steve
« Last Edit: Oct 27th, 2014 at 4:01pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12136
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error creating .elf Due (?) to the character "_" in file and variable names?
Reply #7 - Oct 26th, 2014 at 9:55pm
Print Post  
a few tips

You should be seeing a memory usage figure after compile, if using arduino 1.5.x back-end then there is also a memory usage figure

Otherwise take a look at the document>project properties and you should see a memory usage report true/false setting.

Your own print statements can use F("str") to reduce memory. 

Visual micro doesn't compile the breakpoint "when hit" text messages into the arduino. So commenting your own serial.print statements and using  breakpoints instead can save some memory. 

You can also upload without debugging to see if your lcd is printing.

There is an i2c report that can be enabled to determine if i2c hardware is present.

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