I sometimes entertain myself building Node.js for OpenWrt.
This time I got problem with:
nodejs: v6.9.1
openwrt: brcm-2709 15.05.1 (SDK for RPi2 and current OpenWRT)
The compiler error is: error: 'snprintf' is not a member of 'std'
The error is reproduced by this simple code:
#include <string>
int main() {
char v[8];
std::snprintf(v, 8, "test");
return 0;
}
With my standard (Ubuntu distribution) g++ compiler this error is fixed by using -std=c++11.
That does not help with arm-openwrt-linux-uclibcgnueabi-g++.
However, the very similar C code compiles perfectly with arm-openwrt-linux-uclibcgnueabi-gcc and no switches:
#include <stdio.h>
int main() {
char v[8];
snprintf(v, 8, "test");
return 0;
}
Ideas? Is it:
- just me missing a switch
- a bug in the OpenWRT SDK for C++
- a feature of how the SDK supports C++
Are there any clean workarounds?
I imagine I could fix the problem by replacing std::snprintf with snprintf and include <stdio.h> wherever I get a compile error. That is not very appealing.