I am trying to compile code that will perform an http POST using the GNU c++ compiler, and I get the following error:

http_post2.cpp:93: error: ‘strlen’ was not declared in this scope

The line that it points to is simply:

SEND_RQ("POST ");

I went up to see where SEND_RQ is defined and this is it:

#define SEND_RQ(MSG) \

                /*cout<<send_str;*/ \
    send(sock,MSG,strlen(MSG),0);

I have my includes above this, however and when I've added

#include <stdio.h>

and

#include <stdlib.h>

, it hasn't helped.

strlen is declared in <string.h>, or <cstring> if you want your stuff in the std namespace.

Thanks Narue!

It's perfect now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.