PlatformIO Community

Mbed Project fails to build (memcpy)


#1

Hi,
I just tried to write some basic interfacing code for our robot with ros, but now when I try to compile it, it fails because it seems like it does not know what strlen, memcpy or memset is. I tried it on multiple Computers. In the mbed online compiler it works, so there is no problem with my code or the lib.
I also tried it with lib_ignore=mbed-os. Didn’t do anything different
https:// or http:// will be replaced with https: or http:

platformio.ini:

[env:nucleo_f446re]
platform = ststm32
board = nucleo_f446re
framework = mbed
lib_deps = https:os.mbed.com/users/garyservin/code/ros_lib_kinetic/, https:os.mbed.com/users/sam_grove/code/BufferedSerial/, https:os.mbed.com/users/sam_grove/code/Buffer

Code:

Code

/*
* rosserial Subscriber Example
* Blinks an LED on callback
*/
#include <cstring>
#include <string.h>
using namespace std;
#include “mbed.h”
#include <ros.h>
#include <std_msgs/Empty.h>
ros::NodeHandle nh;
DigitalOut myled(LED1);
void messageCb(const std_msgs::Empty& toggle_msg){
myled = !myled; // blink the led
}
ros::Subscriber<std_msgs::Empty> sub(“toggle_led”, &messageCb);
int main() {
nh.initNode();
nh.subscribe(sub);
while (1) {
nh.spinOnce();
wait_ms(1);
}
}

Output:

Output

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_f446re.html
PLATFORM: ST STM32 > ST Nucleo F446RE
HARDWARE: STM32F446RET6 180MHz 128KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 7 compatible libraries
Scanning dependencies…
Dependency Graph
|-- <ros_lib_kinetic> #a849bf78d77f
| |-- #7e5e866edd3d
| | |-- #89564915f2a7
|-- #7e5e866edd3d
| |-- #89564915f2a7
|-- #89564915f2a7
Compiling .pioenvs\nucleo_f446re\src\main.o
Compiling .pioenvs\nucleo_f446re\lib35d\Buffer\MyBuffer.o
Compiling .pioenvs\nucleo_f446re\lib5a5\BufferedSerial\BufferedSerial.o
In file included from .piolibdeps\Buffer\MyBuffer.h:28:0,
from .piolibdeps\Buffer\MyBuffer.cpp:24:
.piolibdeps\ros_lib_kinetic\std_msgs/string.h: In member function ‘virtual int std_msgs::String::serialize(unsigned char*) const’:
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:26:30: error: ‘strlen’ was not declared in this scope
uint32_t length_data = strlen(this->data);
^~~~~~
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:26:30: note: suggested alternative: ‘strtol’
uint32_t length_data = strlen(this->data);
^~~~~~
strtol
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:29:7: error: ‘memcpy’ was not declared in this scope
memcpy(outbuffer + offset, this->data, length_data);
^~~~~~
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = unsigned char]’:
.piolibdeps\Buffer\MyBuffer.cpp:67:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
memset(_buf, 0, _size);
^~~~~~~~~~
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = signed char]’:
.piolibdeps\Buffer\MyBuffer.cpp:68:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = short unsigned int]’:
.piolibdeps\Buffer\MyBuffer.cpp:69:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = short int]’:
.piolibdeps\Buffer\MyBuffer.cpp:70:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = long unsigned int]’:
.piolibdeps\Buffer\MyBuffer.cpp:71:16: required from here
Archiving .pioenvs\nucleo_f446re\libb23\libros_lib_kinetic.a.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = long int]’:
.piolibdeps\Buffer\MyBuffer.cpp:72:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = long long unsigned int]’:
.piolibdeps\Buffer\MyBuffer.cpp:73:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = long long int]’:
.piolibdeps\Buffer\MyBuffer.cpp:74:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = char]’:
.piolibdeps\Buffer\MyBuffer.cpp:75:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
.piolibdeps\Buffer\MyBuffer.cpp: In instantiation of ‘void MyBuffer::clear() [with T = wchar_t]’:
.piolibdeps\Buffer\MyBuffer.cpp:76:16: required from here
.piolibdeps\Buffer\MyBuffer.cpp:55:11: error: ‘memset’ was not declared in this scope
*** [.pioenvs\nucleo_f446re\lib35d\Buffer\MyBuffer.o] Error 1
In file included from .piolibdeps\ros_lib_kinetic/MbedHardware.h:13:0,
from .piolibdeps\ros_lib_kinetic/ros.h:39,
from src\main.cpp:11:
.piolibdeps\BufferedSerial/BufferedSerial.h:33:8: warning: missing terminating " character
#error “BufferedSerial version 13 and newer requires use of Mbed OS 5.2.0 and newer or Mbed 2 version 130 and newer. Use BufferedSerial version 12 and older or upgrade the Mbed version.
^
In file included from c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:42:0,
from src\main.cpp:5:
.piolibdeps\ros_lib_kinetic\std_msgs/string.h: In member function ‘virtual int std_msgs::String::serialize(unsigned char*) const’:
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:26:30: error: ‘strlen’ was not declared in this scope
uint32_t length_data = strlen(this->data);
^~~~~~
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:26:30: note: suggested alternative: ‘strtol’
uint32_t length_data = strlen(this->data);
^~~~~~
strtol
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:29:7: error: ‘memcpy’ was not declared in this scope
memcpy(outbuffer + offset, this->data, length_data);
^~~~~~
In file included from src\main.cpp:5:0:
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring: At global scope:
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:75:11: error: ‘::memchr’
has not been declared
using ::memchr;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:76:11: error: ‘::memcmp’
has not been declared
using ::memcmp;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:77:11: error: ‘::memcpy’
has not been declared
using ::memcpy;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:78:11: error: ‘::memmove’ has not been declared
using ::memmove;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:79:11: error: ‘::memset’
has not been declared
using ::memset;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:80:11: error: ‘::strcat’
has not been declared
using ::strcat;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:81:11: error: ‘::strcmp’
has not been declared
using ::strcmp;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:82:11: error: ‘::strcoll’ has not been declared
using ::strcoll;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:83:11: error: ‘::strcpy’
has not been declared
using ::strcpy;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:84:11: error: ‘::strcspn’ has not been declared
using ::strcspn;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:85:11: error: ‘::strerror’ has not been declared
using ::strerror;
^~~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:86:11: error: ‘::strlen’
has not been declared
using ::strlen;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:87:11: error: ‘::strncat’ has not been declared
using ::strncat;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:88:11: error: ‘::strncmp’ has not been declared
using ::strncmp;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:89:11: error: ‘::strncpy’ has not been declared
using ::strncpy;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:90:11: error: ‘::strspn’
has not been declared
using ::strspn;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:91:11: error: ‘::strtok’
has not been declared
using ::strtok;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:92:11: error: ‘::strxfrm’ has not been declared
using ::strxfrm;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:93:11: error: ‘::strchr’
has not been declared
using ::strchr;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:94:11: error: ‘::strpbrk’ has not been declared
using ::strpbrk;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:95:11: error: ‘::strrchr’ has not been declared
using ::strrchr;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:96:11: error: ‘::strstr’
has not been declared
using ::strstr;
^~~~~~
In file included from .piolibdeps\BufferedSerial\BufferedSerial.cpp:23:0:
.piolibdeps\BufferedSerial\BufferedSerial.h:33:8: warning: missing terminating " character
#error “BufferedSerial version 13 and newer requires use of Mbed OS 5.2.0 and newer or Mbed 2 version 130 and newer. Use BufferedSerial version 12 and older or upgrade the Mbed version.
^
In file included from C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:20:0,
from C:\Users\juliu.platformio\packages\framework-mbed/events/EventQueue.h:22,
from C:\Users\juliu.platformio\packages\framework-mbed/events/mbed_events.h:29,
from C:\Users\juliu.platformio\packages\framework-mbed/mbed.h:31,
from .piolibdeps\BufferedSerial\BufferedSerial.h:27,
from .piolibdeps\BufferedSerial\BufferedSerial.cpp:23:
.piolibdeps\ros_lib_kinetic\std_msgs/string.h: In member function ‘virtual int std_msgs::String::serialize(unsigned char*) const’:
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:26:30: error: ‘strlen’ was not declared in this scope
uint32_t length_data = strlen(this->data);
^~~~~~
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:26:30: note: suggested alternative: ‘strtol’
uint32_t length_data = strlen(this->data);
^~~~~~
strtol
.piolibdeps\ros_lib_kinetic\std_msgs/string.h:29:7: error: ‘memcpy’ was not declared in this scope
memcpy(outbuffer + offset, this->data, length_data);
^~~~~~
In file included from C:\Users\juliu.platformio\packages\framework-mbed/mbed.h:71:0,
from src\main.cpp:10:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h: In constructor ‘mbed::CANMessage::CANMessage()’:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:48:9: error: ‘memset’ was not declared in this scope
memset(data, 0, 8);
^~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:48:9: note: suggested alternative: ‘fd_set’
memset(data, 0, 8);
^~~~~~
fd_set
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h: In constructor ‘mbed::CANMessage::CANMessage(unsigned int, const char*, char, CANType, CANFormat)’:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:65:9: error: ‘memcpy’ was not declared in this scope
memcpy(data, _data, _len);
^~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h: In constructor ‘mbed::CANMessage::CANMessage(unsigned int, CANFormat)’:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:79:9: error: ‘memset’ was not declared in this scope
memset(data, 0, 8);
^~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:79:9: note: suggested alternative: ‘fd_set’
memset(data, 0, 8);
^~~~~~
fd_set
In file included from C:\Users\juliu.platformio\packages\framework-mbed/mbed.h:92:0,
from src\main.cpp:10:
C:\Users\juliu.platformio\packages\framework-mbed/platform/ATCmdParser.h: In member function ‘void mbed::ATCmdParser::set_delimiter(const char*)’:
C:\Users\juliu.platformio\packages\framework-mbed/platform/ATCmdParser.h:153:30: error: ‘strlen’ was not declared in this scope
_output_delim_size = strlen(output_delimiter);
^~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/platform/ATCmdParser.h:153:30: note: suggested alternative: ‘scalbn’
output_delim_size = strlen(output_delimiter);
^~~~~~
scalbn
In file included from C:\Users\juliu.platformio\packages\framework-mbed/platform/platform.h:26:0,
from C:\Users\juliu.platformio\packages\framework-mbed/mbed.h:39,
from .piolibdeps\BufferedSerial\BufferedSerial.h:27,
from .piolibdeps\BufferedSerial\BufferedSerial.cpp:23:
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring: At global scope:
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:75:11: error: ‘::memchr’
has not been declared
using ::memchr;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:76:11: error: ‘::memcmp’
has not been declared
using ::memcmp;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:77:11: error: ‘::memcpy’
has not been declared
using ::memcpy;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:78:11: error: ‘::memmove’ has not been declared
using ::memmove;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:79:11: error: ‘::memset’
has not been declared
using ::memset;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:80:11: error: ‘::strcat’
has not been declared
using ::strcat;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:81:11: error: ‘::strcmp’
has not been declared
using ::strcmp;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:82:11: error: ‘::strcoll’ has not been declared
using ::strcoll;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:83:11: error: ‘::strcpy’
has not been declared
using ::strcpy;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:84:11: error: ‘::strcspn’ has not been declared
using ::strcspn;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:85:11: error: ‘::strerror’ has not been declared
using ::strerror;
^~~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:86:11: error: ‘::strlen’
has not been declared
using ::strlen;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:87:11: error: ‘::strncat’ has not been declared
using ::strncat;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:88:11: error: ‘::strncmp’ has not been declared
using ::strncmp;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:89:11: error: ‘::strncpy’ has not been declared
using ::strncpy;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:90:11: error: ‘::strspn’
has not been declared
using ::strspn;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:91:11: error: ‘::strtok’
has not been declared
using ::strtok;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:92:11: error: ‘::strxfrm’ has not been declared
using ::strxfrm;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:93:11: error: ‘::strchr’
has not been declared
using ::strchr;
^~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:94:11: error: ‘::strpbrk’ has not been declared
using ::strpbrk;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:95:11: error: ‘::strrchr’ has not been declared
using ::strrchr;
^~~~~~~
c:\users\juliu.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\cstring:96:11: error: ‘::strstr’
has not been declared
using ::strstr;
^~~~~~
In file included from .piolibdeps\ros_lib_kinetic/ros/node_handle.h:41:0,
from .piolibdeps\ros_lib_kinetic/ros.h:38,
from src\main.cpp:11:
.piolibdeps\ros_lib_kinetic/rosserial_msgs/TopicInfo.h: In member function ‘virtual int rosserial_msgs::TopicInfo::serialize(unsigned char*) const’:
.piolibdeps\ros_lib_kinetic/rosserial_msgs/TopicInfo.h:49:36: error: ‘strlen’ was not declared in this scope
uint32_t length_topic_name = strlen(this->topic_name);
^~~~~~
.piolibdeps\ros_lib_kinetic/rosserial_msgs/TopicInfo.h:49:36: note: suggested alternative: ‘scalbn’
uint32_t length_topic_name = strlen(this->topic_name);
^~~~~~
scalbn
.piolibdeps\ros_lib_kinetic/rosserial_msgs/TopicInfo.h:52:7: error: ‘memcpy’ was not declared in this scope
memcpy(outbuffer + offset, this->topic_name, length_topic_name);
^~~~~~
In file included from .piolibdeps\ros_lib_kinetic/ros/node_handle.h:42:0,
from .piolibdeps\ros_lib_kinetic/ros.h:38,
from src\main.cpp:11:
.piolibdeps\ros_lib_kinetic/rosserial_msgs/Log.h: In member function ‘virtual int rosserial_msgs::Log::serialize(unsigned char*) const’:
.piolibdeps\ros_lib_kinetic/rosserial_msgs/Log.h:36:29: error: ‘strlen’ was not declared in this scope
uint32_t length_msg = strlen(this->msg);
^~~~~~
.piolibdeps\ros_lib_kinetic/rosserial_msgs/Log.h:36:29: note: suggested alternative: ‘scalbn’
uint32_t length_msg = strlen(this->msg);
^~~~~~
scalbn
.piolibdeps\ros_lib_kinetic/rosserial_msgs/Log.h:39:7: error: ‘memcpy’ was not declared in this scope
memcpy(outbuffer + offset, this->msg, length_msg);
^~~~~~
In file included from .piolibdeps\ros_lib_kinetic/ros/node_handle.h:43:0,
from .piolibdeps\ros_lib_kinetic/ros.h:38,
from src\main.cpp:11:
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h: In member function ‘virtual int rosserial_msgs::RequestParamRequest::serialize(unsigned char*) const’:
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:27:30: error: ‘strlen’ was not declared in this scope
uint32_t length_name = strlen(this->name);
^~~~~~
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:27:30: note: suggested alternative: ‘scalbn’
uint32_t length_name = strlen(this->name);
^~~~~~
scalbn
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:30:7: error: ‘memcpy’ was not declared in this scope
memcpy(outbuffer + offset, this->name, length_name);
^~~~~~
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h: In member function ‘virtual int rosserial_msgs::RequestParamResponse::serialize(unsigned char*) const’:
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:121:34: error: ‘strlen’ was not declared in this scope
uint32_t length_stringsi = strlen(this->strings[i]);
^~~~~~
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:121:34: note: suggested alternative: ‘scalbn’
uint32_t length_stringsi = strlen(this->strings[i]);
^~~~~~
scalbn
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:124:7: error: ‘memcpy’ was not declared in this scope
memcpy(outbuffer + offset, this->strings[i], length_stringsi);
^~~~~~
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h: In member function ‘virtual int rosserial_msgs::RequestParamResponse::deserialize(unsigned char*)’:
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:153:9: error: ‘memcpy’ was not declared in this scope
memcpy( &(this->ints[i]), &(this->st_ints), sizeof(int32_t));
^~~~~~
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:175:9: error: ‘memcpy’ was not declared in this scope
memcpy( &(this->floats[i]), &(this->st_floats), sizeof(float));
^~~~~~
.piolibdeps\ros_lib_kinetic/rosserial_msgs/RequestParam.h:195:9: error: ‘memcpy’ was not declared in this scope
memcpy( &(this->strings[i]), &(this->st_strings), sizeof(char*));
^~~~~~
In file included from .piolibdeps\ros_lib_kinetic/ros.h:38:0,
from src\main.cpp:11:
.piolibdeps\ros_lib_kinetic/ros/node_handle.h: In member function 'bool ros::NodeHandle
<Hardware, MAX_SUBSCRIBERS, MAX_PUBLISHERS, INPUT_SIZE, OUTPUT_SIZE>::getParam(const char*, char**, int)’:
.piolibdeps\ros_lib_kinetic/ros/node_handle.h:533:15: error: there are no arguments to ‘strcpy’ that depend on a template parameter, so a declaration of ‘strcpy’ must be available [-fpermissive]
strcpy(param[i],req_param_resp.strings[i]);
^~~~~~
.piolibdeps\ros_lib_kinetic/ros/node_handle.h:533:15: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from C:\Users\juliu.platformio\packages\framework-mbed/events/EventQueue.h:22:0,
from C:\Users\juliu.platformio\packages\framework-mbed/events/mbed_events.h:29,
from C:\Users\juliu.platformio\packages\framework-mbed/mbed.h:31,
from src\main.cpp:10:
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h: In instantiation of ‘mbed::Callback<R()>::Callback(R (*)()) [with R = void]’:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/Ticker.h:70:64: required from here
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:86:19: error: ‘memset’ was not declared in this scope
memset(this, 0, sizeof(Callback));
^~~~~~~~~~~~~~~~~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:86:19: note: suggested alternative: ‘fd_set’
memset(this, 0, sizeof(Callback));
^~~~~~~~~~~~~~~~~~~~~
fd_set
In file included from C:\Users\juliu.platformio\packages\framework-mbed/mbed.h:71:0,
from .piolibdeps\BufferedSerial\BufferedSerial.h:27,
from .piolibdeps\BufferedSerial\BufferedSerial.cpp:23:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h: In constructor ‘mbed::CANMessage::CANMessage()’:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:48:9: error: ‘memset’ was not declared in this scope
memset(data, 0, 8);
^~~~~~
*** [.pioenvs\nucleo_f446re\src\main.o] Error 1
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:48:9: note: suggested alternative: ‘fd_set’
memset(data, 0, 8);
^~~~~~
fd_set
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h: In constructor ‘mbed::CANMessage::CANMessage(unsigned int, const char*, char, CANType, CANFormat)’:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:65:9: error: ‘memcpy’ was not declared in this scope
memcpy(data, _data, _len);
^~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h: In constructor ‘mbed::CANMessage::CANMessage(unsigned int, CANFormat)’:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:79:9: error: ‘memset’ was not declared in this scope
memset(data, 0, 8);
^~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/drivers/CAN.h:79:9: note: suggested alternative: ‘fd_set’
memset(data, 0, 8);
^~~~~~
fd_set
In file included from C:\Users\juliu.platformio\packages\framework-mbed/mbed.h:92:0,
from .piolibdeps\BufferedSerial\BufferedSerial.h:27,
from .piolibdeps\BufferedSerial\BufferedSerial.cpp:23:
C:\Users\juliu.platformio\packages\framework-mbed/platform/ATCmdParser.h: In member function ‘void mbed::ATCmdParser::set_delimiter(const char*)’:
C:\Users\juliu.platformio\packages\framework-mbed/platform/ATCmdParser.h:153:30: error: ‘strlen’ was not declared in this scope
_output_delim_size = strlen(output_delimiter);
^~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/platform/ATCmdParser.h:153:30: note: suggested alternative: ‘scalbn’
_output_delim_size = strlen(output_delimiter);
^~~~~~
scalbn
.piolibdeps\BufferedSerial\BufferedSerial.cpp: In member function ‘virtual int BufferedSerial::printf(const char*, …)’:
.piolibdeps\BufferedSerial\BufferedSerial.cpp:84:32: warning: variable length array ‘buffer’ is used [-Wvla]
char buffer[this->_buf_size];
^
.piolibdeps\BufferedSerial\BufferedSerial.cpp:85:5: error: ‘memset’ was not declared in this scope
memset(buffer,0,this->_buf_size);
^~~~~~
.piolibdeps\BufferedSerial\BufferedSerial.cpp:85:5: note: suggested alternative: ‘fd_set’
memset(buffer,0,this->_buf_size);
^~~~~~
fd_set
.piolibdeps\BufferedSerial\BufferedSerial.cpp:92:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(r > this->_buf_size) {
^~~~~~~~~~~~~~~
.piolibdeps\BufferedSerial\BufferedSerial.cpp:93:114: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has
type ‘uint32_t {aka long unsigned int}’ [-Wformat=]
error(”%s %d buffer overwrite (max_buf_size: %d exceeded: %d)!\r\n”, FILE, LINE,this->_buf_size,r);
~~~~~~~~~~~~~~~ ^
In file included from C:\Users\juliu.platformio\packages\framework-mbed/events/EventQueue.h:22:0,
from C:\Users\juliu.platformio\packages\framework-mbed/events/mbed_events.h:29,
from C:\Users\juliu.platformio\packages\framework-mbed/mbed.h:31,
from .piolibdeps\BufferedSerial\BufferedSerial.h:27,
from .piolibdeps\BufferedSerial\BufferedSerial.cpp:23:
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h: In instantiation of ‘mbed::Callback<R()>::Callback(R (*)()) [with R = void]’:
C:\Users\juliu.platformio\packages\framework-mbed/drivers/Ticker.h:70:64: required from here
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:86:19: error: ‘memset’ was not declared in this scope
memset(this, 0, sizeof(Callback));
^~~~~~~~~~~~~~~~~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:86:19: note: suggested alternative: ‘fd_set’
memset(this, 0, sizeof(Callback));
^~~~~~~~~~~~~~~~~~~~~
fd_set
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h: In instantiation of ‘void mbed::Callback<R()>::generate(const F&) [with F = mbed::Callback<void()>::method_context<BufferedSerial, void (BufferedSerial::)()>; R = void]’:
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:110:17: required from 'mbed::Callback<R()>::Callback(U
, R (T::)()) [with T = BufferedSerial; U = BufferedSerial; R = void]’
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:3867:12: required from 'mbed::Callback<R()> mbed::callback(U
, R (T::*)()) [with T = BufferedSerial; U = BufferedSerial; R = void]’
.piolibdeps\BufferedSerial\BufferedSerial.cpp:29:60: required from here
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:643:15: error: ‘memset’ was not declared in this scope
memset(this, 0, sizeof(Callback));
^~~~~~~~~~~~~~~~~~~~~
C:\Users\juliu.platformio\packages\framework-mbed/platform/Callback.h:643:15: note: suggested alternative: ‘fd_set’
memset(this, 0, sizeof(Callback));
^~~~~~~~~~~~~~~~~~~~~
fd_set
*** [.pioenvs\nucleo_f446re\lib5a5\BufferedSerial\BufferedSerial.o] Error 1
================================================ [ERROR] Took 18.62 seconds ================================================

Thanks in advance!
Herobone


#2

The library you use is the problem. It has a header file named String.h, which clashes with the standard C header string.h, thereby making functions inside string.h (strlen(),…) unresolvable. This is because Windows has a case-insensitive filesystem and String.h and string.h is the same for it. Linux systems are however case-sensitive. Since the mbed online compiler uses Linux, it compiles perfectly fine there, but not for your Windows system.

Bugfix:

  • tell the libraries’ author to fix it (since the lib is 3 years old… meh); The fix would be to rename String.h in something else like StringLib.h and changing every occurrence of String.h for StringLib.h.
  • fix the library yourself by forking it, fixing it, and pointing to your fixed fork
  • compile in Linux virtual machine