Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By jcmvbkbc
#29646
trendchaster wrote:just add #include<string.h> at the beginning of the file where you want to use the function.


<string.h> is C header, to get std::string definition you need to #include <string>

trendchaster wrote:user/user_main.c: In function 'mqttConnectedCb':
user/user_main.c:234:3: error: unknown type name 'string'
string str = string(abc[count]);

If you use unqualified 'string' instead of 'std::string' you also need to put 'using namespace ::std;' somewhere in your user_main. And you probably want your user_main to be cpp, not c.