Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Temboo library error Unknown type name 'bool'

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Posts
    3

    Temboo library error Unknown type name 'bool'

    I'm using a teensy 3.6 to try and do some searching of twitter using the Temboo website and library.

    Unfortunately I've fallen at the first fence.
    The library is designed for the Arduino Yun but anyway always was up for a challenge.

    When I include the library and compile I get the error unknown type name 'bool' from one of the files (TembooWebSocketRequestHandles.h). Looks like a fundamental problem somewhere and I'm not sure how the Arduino gets 'bool' defined but obviously it's not picking it up here. Has anyone had the same problem or can suggest what to change/include?

    Fairly simple code:

    #include <Temboo.h>
    void setup()
    {

    }

    void loop()
    {

    }

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,300
    The bool problem is above my pay grade, hopefully one of the language experts will chime in. Here's what I think. The compile error is occurring in .c files that reference the bool type. As I recall, C does not support bool (C++ does). If you compile for an Arudino UNO, the IDE compiles .c files with g++ with no errors. For Teensy, the IDE compiles .c files with gcc and gives the compile error. There might be some command line option for gcc that will support bool, but I don't know what it is. I got your simple Temboo sketch to compile on T3.6 by renaming a couple of .c files in the Temboo lib to .cpp. Specifically, in arduino-1.8.10/libraries/Temboo/src/utility/
    mv TembooWebSocketRequestHandles.c TembooWebSocketRequestHandles.cpp
    mv TembooGPIO.c TembooGPIO.cpp


    I don't know if that will cause other problems, but sketch compiles.

    #include <stdbool.h> defines bool for C programs ... a messy fix for Temboo lib
    Last edited by manitou; 12-15-2019 at 10:44 PM.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,456
    The ARM compiler shipped with Arduino 1.8.10 is version 5.4.1 which was released in June 2016. The AVR compiler is 7.3.0 which was released in January 2018. The current GCC compiler is 9.2.0 which was released in August 2019. GCC 10 will likely be released in a couple of months (we are currently at stage3 of development). As GCC 10 comes out, the GCC 7.x branch will be frozen (GCC 5.x was frozen much earlier).

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,409
    Quote Originally Posted by MichaelMeissner View Post
    The ARM compiler shipped with Arduino 1.8.10 is version 5.4.1 which was released in June 2016. The AVR compiler is 7.3.0 which was released in January 2018. The current GCC compiler is 9.2.0 which was released in August 2019. GCC 10 will likely be released in a couple of months (we are currently at stage3 of development). As GCC 10 comes out, the GCC 7.x branch will be frozen (GCC 5.x was frozen much earlier).
    @MichaelMeissner - was this aimed at this thread? :: forum.pjrc.com/threads/58695-c-17

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,456
    Quote Originally Posted by defragster View Post
    @MichaelMeissner - was this aimed at this thread? :: forum.pjrc.com/threads/58695-c-17
    No it was meant to say that the ARM compiler is older than the AVR compiler, and there might be things that the newer compiler provides by default. I do tend to agree that including stdbool.h is probably the right solution. I just didn't have time to dig in exactly where bool is defined in the AVR world.

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,409
    Quote Originally Posted by MichaelMeissner View Post
    No it was meant to say that the ARM compiler is older than the AVR compiler, and there might be things that the newer compiler provides by default. I do tend to agree that including stdbool.h is probably the right solution. I just didn't have time to dig in exactly where bool is defined in the AVR world.
    Opps - missed the connection … and misread.

  7. #7
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,300
    Quote Originally Posted by MichaelMeissner View Post
    No it was meant to say that the ARM compiler is older than the AVR compiler, and there might be things that the newer compiler provides by default. I do tend to agree that including stdbool.h is probably the right solution. I just didn't have time to dig in exactly where bool is defined in the AVR world.
    Well, on linux-64 1.8.10/1.48 I see that IDE build is using gcc for .c files for UNO, DUE, ZERO, adafruit circuit express(SAMD21), M4 (SAMD51), and there is no error for .c files using bool. So the non-Teensy builds must have bool defined in some default include path. I did not see any magic gcc command line switches.

    Another data point, compile fails for Teensy 2.0 as well as Teensy 3* , Teensy 4

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,128
    Looks like Arduino is including stdbool.h, which defines this C++ stuff for C language.

    I've committed a fix so it will work on Teensy.

    https://github.com/PaulStoffregen/co...330bb4512ce7c0

    If you manually apply this and care about compiler warnings, also get this one:

    https://github.com/PaulStoffregen/co...d4acce5f2ea5ea

  9. #9
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,300
    Quote Originally Posted by PaulStoffregen View Post
    Looks like Arduino is including stdbool.h, which defines this C++ stuff for C language.

    I've committed a fix so it will work on Teensy.

    https://github.com/PaulStoffregen/co...330bb4512ce7c0
    OK. test sketch compiles now on T4, T3.6, T2.0.

    thanks

  10. #10
    Junior Member
    Join Date
    Nov 2019
    Posts
    3
    Quote Originally Posted by manitou View Post
    OK. test sketch compiles now on T4, T3.6, T2.0.

    thanks
    Thanks everyone. All ok now!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •