Compilling Error

hello guys this is the error I am getting for the attached code.
Would you please help me to figure out what is wrong and how to solve it.
Thanks

In file included from try2.cpp:3:
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial/SoftwareSerial.h:52: error: conflicting return type specified for ‘virtual void SoftwareSerial::write(uint8_t)’
C:\Users\ROGERANT\Desktop\arduino-1.0.1\hardware\arduino\cores\arduino/Print.h:48: error: overriding ‘virtual size_t Print::write(uint8_t)’

try2.ino (2.96 KB)

What does easyVR do?

In SoftSerial.h and SoftSerial.cpp find the following:

virtual void SoftwareSerial::write(uint8_t)
and/or
void SoftwareSerial::write(uint8_t)

and change it to:
virtual size_t SoftwareSerial::write(uint8_t)
and/or
size_t SoftwareSerial::write(uint8_t)

in the CPP file, you will also have to add to the end of the function mentioned above:
return 1;

Hi Tom,
Thanks for your advice,
I found the cpp file and I changed it as you said but the error still stands,
even if i run the example code for easyvr it still give me that error.

Could you attach as a zip your Print.h and SoftwareSerial (both the .h and .cpp) files, an I will have a look for you.

Hi Tom
I’ve included all three files in that folder as you requested.
thanks

SoftwareSerial.rar (5.65 KB)

In SoftwareSerial.h, change this line:

    void write(uint8_t);

To :

    size_t write(uint8_t);

And in SoftwareSerial.cpp, change this:

size_t SoftwareSerial::write(uint8_t )
{
  if (_baudRate == 0)
    return;
  ...
  ...

To:

size_t SoftwareSerial::write(uint8_t )
{
  if (_baudRate == 0)
    return 0;
  ...
  ...

That solved the problem and triggered this set of error compiling.

C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:30:24: error: WConstants.h: No such file or directory
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::tx_pin_write(uint8_t)':
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:51: error: 'LOW' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:68: error: 'INPUT' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:68: error: 'pinMode' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:69: error: 'HIGH' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:69: error: 'digitalWrite' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:70: error: 'digitalPinToBitMask' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:71: error: 'digitalPinToPort' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:71: error: 'portInputRegister' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:73: error: 'OUTPUT' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:76: error: 'portOutputRegister' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::end()':
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:84: error: 'INPUT' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:84: error: 'pinMode' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:85: error: 'HIGH' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:85: error: 'digitalWrite' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual int SoftwareSerial::read()':
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:104: error: 'LOW' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:107: error: 'delayMicroseconds' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual size_t SoftwareSerial::write(uint8_t)':
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:134: error: 'byte' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:134: error: expected `;' before 'mask'
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:136: error: 'LOW' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:137: error: 'delayMicroseconds' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:139: error: 'mask' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:140: error: 'b' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:141: error: 'HIGH' was not declared in this scope
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:147: error: 'HIGH' was not declared in this scope

rogerant:
That solved the problem and triggered this set of error compiling.

Out of curiosity, what do you have selected in the Tools > Board menu?

I got these same error when using old hardware core files with the Attinys.

~Oh right yeah missed that,

at the top of SoftwareSerial.cpp, change this:

#include "WConstants.h"

to this:

#include "Arduino.h"

in tools > board > arduino uno is selected
after the last change This is the result.

C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual size_t SoftwareSerial::write(uint8_t)':
C:\Users\ROGERANT\Desktop\arduino-1.0.1\libraries\SoftwareSerial\SoftwareSerial.cpp:140: error: 'b' was not declared in this scope

Ahh, I think when you changed one of the lines, you removed something important. This:
size_t SoftwareSerial::write(uint8_t )
Should be this:
size_t SoftwareSerial::write(uint8_t b)

Thank you so much, I did everything it was giving me similar problem but this time in newsoftserial and I followed the same instructions and it is all working perfectly.
Thanks alot Tom!! XD :grin: