Go Down

Topic: Problem with Serial.begin in revision 1141 (Read 852 times) previous topic - next topic

adam barta

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


Jeffrey Sun

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.

Coding Badly


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.

adam barta

the sketch is simple.

Code: [Select]

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.

Coding Badly


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.

adam barta

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

Code: [Select]

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


to main.cpp

now to test it serial if it is actually working.

Coding Badly


adam barta

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

Go Up