error in modbusmaster

Hi,
I am using ModbusMaster.cpp sketch for my project but I am struck getting an error: '_u8SerialPort' was not declared in this scope

ModbusMaster::ModbusMaster(void)
{
  _u8SerialPort = 0;
  _u8MBSlave = 1;
}

Well, from the snippet you posted, that's true.

You're welcome.

A hint for heip

thank you for replay here I am attaching the full sketch.

final_sketch.ino (25.1 KB)

That looks like a .cpp file from a library, rather than a sketch.

here I am attaching the full sketch.

Here I am saying, "No, I can't see it in there either".

I'm out, sorry! If reading the How to use the forum is too much...

yes its library I got it from github

jai365:
yes its library I got it from github

If only we had a link. {sigh}

OK, your final_sketch

ModbusMaster::ModbusMaster(void)
{
  _u8SerialPort = 0;
  _u8MBSlave = 1;
}

The same constructor from GitHub

ModbusMaster::ModbusMaster(void)
{
  _idle = 0;
  _preTransmission = 0;
  _postTransmission = 0;
}

So?

yes but when I am compelling sketch getting errors I need help to solve that errors

jai365:
yes but when I am compelling sketch getting errors I need help to solve that errors

So, start answering questions - where did the code that doesn't compile come from,and why is it so different to the GitHub code you linked?

when you try to compile github code you will get an error.

jai365:
when you try to compile github code you will get an error.

I'm posting from my phone, so I'm not about to do that, so why don't you tell us what that error is?

Come on - help others to help you

I didn't change git hub code I got this code from this sitehttp://www.polz.info/sdm630_arduino_howto.php#shieldv1
I doing the same project with little changes

Error is `final_sketch:50: error: '_u8SerialPort' was not declared in this scope

_u8SerialPort = 0;

Well, I don't believe that the code from GitHub that you linked earlier includes the string "_u8SerialPort", so couldn't generate that error.

yes but I am getting the error that's the reason I posted in the forum, please explain to me what's wrong in the code

The compiler is telling exactly what's wrong - you have nothing called " _u8SerialPort" declared in that scope.
Invent something called that, put it in the class definition in the .h file, and Bob's your auntie's live-in lover.