Announcement

Collapse
No announcement yet.

Basic C++ question about Arduino

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Basic C++ question about Arduino

    It's been a little while since I've used C++
    I think this is a somewhat basic error.

    I'm following through the tutorial for a graphic lcd.
    http://www.sparkfun.com/tutorials/300

    The main file checks out ok, minus the .h file it won't recognize.

    The first line: #include "PCD8544.h"

    So then we head over to that .h file.
    Lots of defines, then we get down to line 52ish, which is where I get the issue.

    PCD8544.h:52:28: error: expected class-name before ‘{’ token
    And the code:
    class PCD8544 : public GFX {
    None of the other .h or .cpp files give me errors.
    Any ideas?
    MRT
    37.5 MPG, AC on, cruising at 80.
    30.0 MPG, AC on, aggressively driving around 90.
    27.5 MPG, no AC, cruising at 90 with occasional gridlock. 40 degrees Fahrenheit

    Lots of DIY videos specifically for our car

    Get some awesome wipers! <-- It's a DIY
    Originally posted by Tippey764
    I think driving your car naked will cause the engine to overheat
    Originally posted by deevergote
    sneaky motherfucker

    #2
    It's complaining because it doesn't know what "GFX" is. It expects it to be the name of a class, but it apparently hasn't been defined as such.

    You're probably missing a "#include <GFX.h>" or "#include "GFX.h"" or similar, in the file where that code resides.

    Comment


      #3
      That solved it.

      This is one of the shittiest tutorials I've ever used.
      The library it references (what gave me trouble) is always changing, so the tutorial is out of date.
      On top of that, the library doesn't work.
      Once you get that fixed, the actual code from the tutorial requires fixing as well!

      I got it to compile. I'll see if it works when I get home to my Arduino itself.
      MRT
      37.5 MPG, AC on, cruising at 80.
      30.0 MPG, AC on, aggressively driving around 90.
      27.5 MPG, no AC, cruising at 90 with occasional gridlock. 40 degrees Fahrenheit

      Lots of DIY videos specifically for our car

      Get some awesome wipers! <-- It's a DIY
      Originally posted by Tippey764
      I think driving your car naked will cause the engine to overheat
      Originally posted by deevergote
      sneaky motherfucker

      Comment


        #4
        Yeah, it sounds like the library has some issues. You shouldn't have to modify the library, or have to work-around or fix it in any manner; that PDxxx.h should already include the proper definitions. That's a problem with any software though, not just libraries or open source.

        Glad you got it working.

        Comment


          #5
          Thanks!

          The library itself seemed like it was modified out of sequence. It was made by a group called AdaFruit. They decided to randomly all AdaFruit to the beginning of some of the classes, and others not. I used a find and replace to pull them out.
          MRT
          37.5 MPG, AC on, cruising at 80.
          30.0 MPG, AC on, aggressively driving around 90.
          27.5 MPG, no AC, cruising at 90 with occasional gridlock. 40 degrees Fahrenheit

          Lots of DIY videos specifically for our car

          Get some awesome wipers! <-- It's a DIY
          Originally posted by Tippey764
          I think driving your car naked will cause the engine to overheat
          Originally posted by deevergote
          sneaky motherfucker

          Comment

          Working...
          X