Pages: [1]   Go Down
Author Topic: The PS2X library suddenly refuses to compile  (Read 266 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 10, 2013, 06:51:38 pm by Jon Dahm » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's not an error message. smiley-razz 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.
« Last Edit: January 10, 2013, 07:36:04 pm by Jon Dahm » Logged

Pages: [1]   Go Up
Jump to: