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

Thread: Error Compiling SerialTerminalPRO example

  1. #1

    Error Compiling SerialTerminalPRO example

    Install the SerialTerminalPRO v1.1.1 library
    Open the libraries 'calculator' example
    Try to compile and you're presented with the following error.
    Code:
    In file included from /Users/patricklittle/Documents/Arduino/libraries/SerialTerminalPRO-1.1.1/examples/calculator/calculator.ino:1:0:
    /Users/patricklittle/Documents/Arduino/libraries/SerialTerminalPRO-1.1.1/SerialTerminal.hpp: In static member function 'static maschinendeck::Pair<String, String> maschinendeck::SerialTerminal::ParseCommand(String)':
    /Users/patricklittle/Documents/Arduino/libraries/SerialTerminalPRO-1.1.1/SerialTerminal.hpp:174:26: error: 'begin' was not declared in this scope
             for (auto& car : message) {
                              ^
    /Users/patricklittle/Documents/Arduino/libraries/SerialTerminalPRO-1.1.1/SerialTerminal.hpp:174:26: note: suggested alternative:
    In file included from /Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/c++/5.4.1/utility:75:0,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/wiring.h:89,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/WProgram.h:45,
                     from /var/folders/0q/kx24shts5396rqt4r2rgpkfr0000gn/T/arduino_build_639362/pch/Arduino.h:6:
    /Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/c++/5.4.1/initializer_list:89:5: note:   'std::begin'
         begin(initializer_list<_Tp> __ils) noexcept
         ^
    In file included from /Users/patricklittle/Documents/Arduino/libraries/SerialTerminalPRO-1.1.1/examples/calculator/calculator.ino:1:0:
    /Users/patricklittle/Documents/Arduino/libraries/SerialTerminalPRO-1.1.1/SerialTerminal.hpp:174:26: error: 'end' was not declared in this scope
             for (auto& car : message) {
                              ^
    /Users/patricklittle/Documents/Arduino/libraries/SerialTerminalPRO-1.1.1/SerialTerminal.hpp:174:26: note: suggested alternative:
    In file included from /Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/c++/5.4.1/utility:75:0,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/wiring.h:89,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/WProgram.h:45,
                     from /var/folders/0q/kx24shts5396rqt4r2rgpkfr0000gn/T/arduino_build_639362/pch/Arduino.h:6:
    /Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/c++/5.4.1/initializer_list:99:5: note:   'std::end'
         end(initializer_list<_Tp> __ils) noexcept
         ^
    Using library SerialTerminalPRO-1.1.1 at version 1.1.1 in folder: /Users/patricklittle/Documents/Arduino/libraries/SerialTerminalPRO-1.1.1 
    Error compiling for board Teensy 3.6.
    Source code of example, but the error is thrown by the library's .hpp file
    HTML Code:
    #include <SerialTerminal.hpp>
    
    maschinendeck::SerialTerminal* term;
    
    void addInt(String opts) {
      maschinendeck::Pair<String, String> operands = maschinendeck::SerialTerminal::ParseCommand(opts);
      Serial.print(operands.first());
      Serial.print(" + ");
      Serial.print(operands.second());
      Serial.print(" = ");
      Serial.print(operands.first().toInt() + operands.second().toInt());
      Serial.print('\n');
    }
    
    void setup() {
      term = new maschinendeck::SerialTerminal(38400);
      term->add("add", &addInt, "adds to integers");
    }
    
    void loop() {
      term->loop();
    }
    I reported the bug to SerialTerminalPRO and he traced it down to the version of the Arduino.h file packaged with Teensyduino, claiming it's not up to date.
    https://github.com/miko007/SerialTer...ment-902610304

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,054
    His example
    Code:
    void setup() {
      String foo = "Hello";
      for (auto& car : foo) {
        Serial.print(car);  
      }
    }
    works, if you just add these lines to wstring.h
    Code:
        // character acccess
        char charAt(unsigned int index) const;
        void setCharAt(unsigned int index, char c);
        char operator [] (unsigned int index) const;
        char& operator [] (unsigned int index);
        void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const;
        void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
            {getBytes((unsigned char *)buf, bufsize, index);}
        const char * c_str() const {
            if (!buffer) return &zerotermination; // https://forum.pjrc.com/threads/63842
            return buffer;
        }
        
        char* begin() { return buffer; }
        char* end() { return buffer + length(); }
        const char* begin() const { return c_str(); }
        const char* end() const { return c_str() + length(); }
        
        // search
        int indexOf( char ch ) const;

  3. #3
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,054
    Does it help for "calculator"?

  4. #4
    Quote Originally Posted by Frank B View Post
    Does it help for "calculator"?
    Yes it does work, thank you.

    Will this update get rolled into the release of Teensyduino?

    I would like to avoid have to instruct the client how to edit the included libraries.

  5. #5
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,054
    It would help to remind Paul by posting in the 1.55beta thread( in :Announcements")

    Thank you.
    I guess we see a 1.55 beta2 soon.

  6. #6
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,054

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,769
    I've committed a fix for this problem.

    https://github.com/PaulStoffregen/co...2ebd3f9e0fdee2

    It'll be in 1.55-beta3

Posting Permissions

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