PropWare icon indicating copy to clipboard operation
PropWare copied to clipboard

Servo.h clashes with servo.h

Open BloodWorkXGaming opened this issue 6 years ago • 11 comments

The simpletools library servo.h can't really be used as there is a Servo.h library as well. It is very mixed when which one gets included as the only difference is the capital S. (Works on one PC, doesn't on the other)

BloodWorkXGaming avatar Feb 26 '19 16:02 BloodWorkXGaming

Oohhhh.... Oh Microsoft. That's annoying, for sure. Okay, I'll add a CMake option (which will default to OFF) to include Arduino's Servo.h (I'm guessing that's where the other one is coming from)

DavidZemon avatar Feb 26 '19 16:02 DavidZemon

Awesome, thanks!

BloodWorkXGaming avatar Feb 26 '19 22:02 BloodWorkXGaming

You're not trying to use both Simple and libPropelleruino, are you?

DavidZemon avatar Feb 28 '19 02:02 DavidZemon

@BloodWorkXGaming, please try downloading the version of PropWare available in either of the two builds linked above (click the green checkmark to get a link to the build on the CI server). This will let you test the change prior to me merging it in.

DavidZemon avatar Feb 28 '19 04:02 DavidZemon

Well, yes, I am using both simple and libpropeller. Is there anything wrong with that? serial.h from libpropellor (as that is waaaay better than fdserial from simple) and abdrive360 + servo.h from simple as there is no equivalent in libprobellor for that.

Will the new commits and come back to you, thanks!

BloodWorkXGaming avatar Feb 28 '19 06:02 BloodWorkXGaming

Okay, so just tested the build but it sadly doesn't fix the issue. As all subdirectories are roots for the import it doesn't really change much as the compiler still can't decide. If I could do something like #include "Simple/servo.h" that might help.

Also, due to those changes there is now a PropWare/PropWare and a Libpropeller/libpropeller folder

BloodWorkXGaming avatar Feb 28 '19 07:02 BloodWorkXGaming

I forgot a pretty critical part: replace find_package(PropWare REQUIRED) with

find_package(PropWare REQUIRED
    COMPONENTS Simple LibPropeller PropWare ArdionoJson)

This will exclude LibPropelleruino (note: not libPropeller) which has Servo.h. The extra level of directories is necessary for CMake to have this kind of control. And though you and I would be fine with <simple/simpletools.h>, it would completely break compatibility with code written in SimpleIDE and the Simple itself (look at the include lines in simpletools.h and you'll see what I mean).

Also, keep this in mind if you ever write your own library... Make sure the headers are in a subdirectory with some kind of distinguishing name.

DavidZemon avatar Feb 28 '19 12:02 DavidZemon

Okay with the new line in there I get the error

  PropWare's LibPropeller component not available due to missing
  PropWare::LibPropeller_cog
Call Stack (most recent call first):
  CMakeLists.txt:2 (find_package)

BloodWorkXGaming avatar Feb 28 '19 14:02 BloodWorkXGaming

Ah, that's I get for trying to think at 6am. Try

find_package(PropWare REQUIRED
    COMPONENTS Simple Libpropeller PropWare ArdionoJson)

And of course, the PropWare and ArduinoJson components are optional since you're not using them.

DavidZemon avatar Feb 28 '19 14:02 DavidZemon

Just noticed I am indeed using libpropellerino for the WString.h, so simply excliding it didn't fix it. Copied the serial.h and serial.c code I needed into my project as a workaround.

BloodWorkXGaming avatar Feb 28 '19 14:02 BloodWorkXGaming

Oh... bummer. Alright, I'll come up with something better (I'm going to leave the componentized folders though, and that's another thing that really should have been done a while ago).

DavidZemon avatar Feb 28 '19 14:02 DavidZemon