Go Down

Topic: The PS2X library suddenly refuses to compile (Read 329 times) previous topic - next topic

Jon Dahm

For reference, the PS2X library can be found here:
http://www.billporter.info/2010/06/05/playstation-2-controller-arduino-library-v1-0/

I've been working with this library for about a day or two, and so far it's been doing me well. However, just a couple hours ago, every program that I include its header in refuses to compile, including the example. I don't recall making any significant changes to it.

Below is an incredibly simple program I wrote that uses absolutely nothing from the library. Without the include statement at the top, it compiles. With the include statement, it explodes with the errors listed in the next post (it was too long to fit in this post).

Code: [Select]
#include <PS2X_lib.h>

void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  digitalWrite(13, HIGH);
  Serial.println("ON");
  delay(1000);
 
  digitalWrite(13,LOW);
  Serial.print("OFF\n");
  delay(1000);
}


I've tried including the SPI library, as well, and it doesn't give me any trouble. It looks, judging from the error locations, as if the problem is with the built-in AVR hardware libraries, but I don't know a) why that would cause problems with print and println, nor b) why that should start happening now -- I haven't touched anything past the header file for the PS2X library, where I only made minor spacing changes (and if I remember correctly, I only made them in a copy outside the libraries folder I had for actually figuring out what this guy did).

I looked for other people with the print/println problem at the end of the explosion, and it was suggested that all #include "WProgram.h" statements should be replaced with #include "Arduino.h" for IDEs version 1.0+ (mine is 1.0.3), so I tried that and I still get the same errors. I haven't yet uninstalled/reinstalled the Arduino IDE and the PS2X library, but I'd rather that be a last resort if there's really nothing else I can do.

Does anyone have any idea what I could try next? I've only recently gotten into Arduino, so I don't have the most extensive knowledge in the area.

Jon Dahm

#1
Jan 11, 2013, 12:43 am Last Edit: Jan 11, 2013, 12:51 am by Jon Dahm Reason: 1
Erm, hold on, the error message is so long I can't put it in this message. I'll put a link to a pastebin with the errors.

EDIT::

Here is a link to the error logs:

http://pastebin.com/peXdmpuE

Putting the errors in this format has actually made it incredibly clear that the problem is with an apparently botched typedef that defines "size_t". Huh. I'm going to try locating and fixing this problem to see what it does, and I'll get back soon.

PaulS

I downloaded the library, and pasted your code into the IDE. The error message I got was very short:
Quote
Binary sketch size: 4,284 bytes (of a 258,048 byte maximum)

Jon Dahm

#3
Jan 11, 2013, 01:24 am Last Edit: Jan 11, 2013, 01:36 am by Jon Dahm Reason: 1
That's not an error message. :P However, that is what I was getting before. Maybe I do need to reinstall. I'm going to restart my computer again and see what that does.


FINAL EDIT::

*sigh* I am so sorry for wasting your time. It turned out reinstalling the library fixed everything. :smiley-red: Lesson learned: if a library causes you trouble, reinstall the library. It's not that hard.

Go Up