Go Down

Topic: strange error (Read 452 times) previous topic - next topic

MrAndrews

May 19, 2009, 04:45 am Last Edit: May 19, 2009, 02:59 pm by MrAndrews Reason: 1
when i hit verify on the ide i get a strange error with one particular program. i have seen this error elsewhere on the boards but the fixes suggested havnt worked for me. here is the error:

C:\Users\Owner\AppData\Local\Temp\build6619.tmp\core.a(wiring_serial.c.o): In function `__vector_18':


C:\Users\Owner\Desktop\arduino-0015\hardware\cores\arduino/wiring_serial.c:112: multiple definition of `__vector_18'


C:\Users\Owner\AppData\Local\Temp\build6619.tmp\core.a(HardwareSerial.cpp.o):C:\Users\Owner\Desktop\arduino-0015\hardware\cores\arduino/HardwareSerial.cpp:95: first defined here


Couldn't determine program size: C:\Users\Owner\Desktop\arduino-0015\hardware/tools/avr/bin/avr-size: 'C:\Users\Owner\AppData\Local\Temp\build6619.tmp\sketch_090519c.hex': No such file


a few people were saying in other threads that it could likely be an error in the program stopping the program from compiling and therefore causing the unknown size error at the bottom, but i dont think this is the cause. ill include the code anyway

Code: [Select]
int pin1 = 2;
int serialIn;

void setup ()
{
 Serial.begin(9600);
 pinMode(pin1,OUTPUT);
}

void loop ()
{
 serialIn = serialRead();
 if (serialIn = 49)
 {
   digitalWrite (pin1,HIGH);
 }
}



I am running Windows Vista Intel Core 2 duo 1.66 GHz. any help would be greatly appreciated

EDIT: problem solved, it was a syntax error (shame on me). Thanks for the quick replies and help

Coding Badly

What files are in the Sketch directory?

- Brian

wayoda

Hi MrAndrews,

Inside the loop function your are calling
Code: [Select]

 serialIn = serialRead();

but function serialRead happens to be the name of an internal function of the basic Arduino-source files. This function was not intened to  be called from Sketches like yours, but there is also no way to prevent  it to happen by accident :-(

But this is just a short explanation why the error is reported. The solution is simple :

Use the function Serial.read()
Code: [Select]

 serialIn = Serial.read();

Yes, the same characters  but in different case and a dot in the middle, a bit confusing when you just started with programming. But this really is a totally different function, and the one you should use in your sketches.
http://arduino.cc/en/Serial/Read

Eberhard

marcboon

i think you mean to do
Code: [Select]
if(serialIn == 49) instead of
Code: [Select]
if(serialIn = 49)

MrAndrews

@Wayoda, thanks so much for the help. i was actually meaning to use the built in function Serial.read but didnt realize my mistake when i was debugging. iv fixed the error and it works fine now

Go Up