Pages: [1]   Go Down
Author Topic: (SOLVED) Pragma Compiler Directives for IDE 1.0  (Read 1622 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was wondering if anyone has come up with some pragma compiler directives, so we can write or modify old code without maintaining multiple versions of the code that we write. I have searched this forum, with no luck. But as with all Forums, it is hard to find information sometimes. I think if we could solve this issue, the community could be informed how to write code more efficiently to cover both streams.

For instance, the wire library has changed some methods, and I would like my #defines to be able to identify and change the code for both the old and new methods using pre-compiler directives, possibly through pragma data.

Any other suggestions on how to handle this issue are also welcome.

Thanks in advance for your advice.
« Last Edit: January 31, 2012, 09:53:41 am by jvaughters » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 220
Posts: 13836
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


something like:

#if ARDUINO >= 100
    #include <EthernetUdp.h>
#else
    #include <UDP.h>
#endif   

#if ARDUINO >= 100
    #include "Arduino.h"
#else
    #include "WProgram.h"
#endif
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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

Thanks for the reply, I also have seen this type, but have not tried yours or this yet, but I know this will solve the issue. It was the ARDUINO value I needed to be able to create Pre-Complier solutions.

// Arduino 1.0 compatibility
#if defined(ARDUINO) && ARDUINO >= 100
    #include "Arduino.h"
#else
    #include "WProgram.h"
#endif
« Last Edit: January 31, 2012, 09:58:40 am by jvaughters » Logged

Pages: [1]   Go Up
Jump to: