OrangutanAnalogExample - inline method?

Just started getting my 3pi development platform together. Initially, I’ve decided to go the Arduino route as I already have the environment set up, so it’s a lot easier than setting up AVRStudio etc… this all seems to be working fine (after fixing up some pin naming changes in the library: PB1>PORTB1 etc.) apart from one exception.

OrangutanAnalogExample makes a call to conversionResult() that fails to compile. It turns out that this is because the method is defined as “inline” in OrangutanAnalog.cpp. I’m an experienced programmer (not C++) and know what inline does, but am puzzled as to why this should fail. I presume the method was made inline as it is so short. If I remove the inline keyword, all is well…

I’m inclined to think this is a compiler bug, but wanted to get a second opinion.

Thanks, Steve.

I should add that I dug around on here and the Arduino site but didn’t find anything that helped…

Steve.

Without seeing your error message I cannot be sure exactly what you are encountering, but making that an inline function is a mistake on our part that we have corrected in later releases of the AVR C/C++ library. When we make another release of the Arduino library, that bug should also be fixed. The problem is that inline functions are not visible outside of the current compilation - so you generally cannot call an inline function that is in another cpp file. It is possible that a previous version of the compiler ignored the inline request, or that you are the first person to try to call ConversionResult directly from your code.

So you are doing the right thing by fixing it! However, if you are an experienced programmer, I strongly suggest that you just try installing the full WinAVR. It is really not that hard to do, and you will then have access to a complete, fully documented set of tools as well as a more up-to-date Pololu library.

Either way, good luck with your project! Feel free to ask more if you run into other problems.

-Paul

Thanks for the comprehensive reply. I meant to post the error message - basically complained about the method not being defined. I can see it is a lot easier to contain inlines within a compilation unit - should have thought of that!

I work mainly with PICs and wanted to avoid clogging my computer with another environment, but no doubt will when I get beyond simple playing.

Thanks again, Steve.