Other Software Development
Topic: Sloeber/CDT/Eclipse/Me problem?
(Read 310 times)
Mar 09, 2017, 06:59 pm
Hello. I am frustrated with a invalid arguments semantic error I am getting from Eclipse working on a small library for an Arduino project. I am very, very rusty programming in C++ and I am trying out the Sloeber plugin for Eclipse (loving it so far!) so I am not even certain where my problem lies but odds are great that I am just doing something stupid due to how much I have forgotten about C++.
This screenshot shows the issue pretty clearly, I think. Lines 48 and 49 both get the invalid argument error but it sure looks to me like I am passing a correct arg (int). Indeed, I completed these lines using the autocomplete suggestion drop-down list in Eclipse. Line 53 is just from me experimenting and noticing that the problem only seems to happen when I call a member function with an argument. Calling one with no args does not raise a flag.
I have been combing through my old C++ reference books trying to find what I am missing here, but if anyone in this community can offer some tips on what to look for I would greatly appreciate it.
Seattle, WA USA
Re: Sloeber/CDT/Eclipse/Me problem?
Mar 13, 2017, 10:40 am
This screenshot shows the issue pretty clearly, I think.
I don't. The text in the picture is too small and fuzzy for me to read.
The this pointer is used, in C++ to distinguish a member field from a local variable, or argument, of the same name. In most cases, it is far better to NOT use the name of a member variable as an argument, so that you don't need to populate your code with all those this->s.
I copied your picture, and I can't see why Eclipse is complaining about that call. But, then, Eclipse can see your header file, and I can't. If getTempWithBeta() is defined in the header file as taking an int and returning a double, as it is implemented, then Eclipse is wrong about there being a problem.
If getTempWithBeta() is defined with some other signature, then the implementation is wrong, and Eclipse may have a valid point.
The art of getting good answers lies in asking good questions.