Pages: [1]   Go Down
Author Topic: Problem with Serial.begin in revision 1141  (Read 790 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello

I am unable to compile a simple program with Serial.begin

i get this error

applet/core.a(Print.o): In function `Print::print(String const&)':
Print.cpp:(.text+0xa6): undefined reference to `String::operator[](unsigned int) const'

Anyone able to help??

Uncommenting some lines in Print.cpp allow it to compile but it still doesn't work

Logged

China
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you paste the source code of your sketch?


Which Arduino IDE version are you using? I tried with 0021. The serial functionality works well.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 209
Posts: 13015
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


This problem surfaced last week.  Unfortunately the schmuck failed to indicate if my suggestion helped.  Regardless of the advice I give, if you get past this problem, PLEASE report back.

Remove the String library.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the sketch is simple.

Code:
void setup(){
   Serial.begin(9600);
}
void loop(){

}

i'm not using an arduino ide.. i followed the OpenBSD CLI steps and am compiling in ubuntu 10.10

Could it be a problem with the linking in the Makefile?
i had to mangle the bsdmakefile a bit but it compiles something simple with blinkin lights fine.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 209
Posts: 13015
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


The problem is a String class that is out-of-date relative to Serial.  You need to locate the WString.h and WString.ccp files (or corresponding object file) that don't belong and delete them.

In other words, search for WString.h in a String subdirectory.  If you find one, delete it.  Repeat for WString.ccp.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok I managed to get it to work by adding WString.cpp to the make file and also adding

Code:
extern "C" void __cxa_pure_virtual()
{
  while (1);
}

to main.cpp

now to test it serial if it is actually working.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 209
Posts: 13015
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Thank you for the follow-up.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool

I guess the main problem is that the makefile is not included in the SVN repo so it's probs out of sync with whats going on..

I don't know how the arduino java system works but i think it would be cool to have a Makefile in svn.

l8
Adam
Logged

Pages: [1]   Go Up
Jump to: