Symbolic Constant for simulator

2 replies [Last post]
brada
Title: NooBot
Joined: 03/23/2012
Posts:
BotPoints: 36
User offline. Last seen 8 years 24 weeks ago.

Is there a symbolic constant defined so that I can conditionally compile code for the simulator? Is there one for the Link?

thanks,
Brad August

Brad A.
Team 13-0624
Fairfield, IL

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

I'm not 100% sure, but I think this will detect that it's being compiled for the Link:

#ifdef __arm__

You can use #ifndef instead of #ifdef to instead compile only for non-Link environments (e.g. the simulator).

Note that ARM-based devices such as Windows RT and Android devices will be detected as Links (although I can't imagine why you would be running the KISS-IDE simulator on Windows RT or Android).

If this works, please let us know.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

KCotrone
Title: NooBot
Joined: 01/29/2013
Posts:
BotPoints: 38
User offline. Last seen 8 years 48 weeks ago.

I can confirm that  #ifdef __arm__ works. I used it for a while with the link.

You can also check for windows if you want to do that by:
#ifdef _WIN32 I believe.

I used this to import the libkovan from KIPR's github so I could use codeblocks.