Hi everyone. I'm using GCC to compile code according to the C99 standard.
I'm using libcurl to make HTTP requests. I need to call the function curl_easy_setopt where the third parameter is a "pointer to a zero-terminated string." GCC chokes on the following code, claiming that for the third parameter: invalid application of 'sizeof' to incomplete type 'const char[]'.
Note that if I put the szuseragent definition in the same translation unit, it works. Also, if I change szuseragent to &szuseragent[0], it works!
Is it my fault or gcc's?
Code:
#include "Variables.h"
int setuseragent ( void)
{
curl_easy_setopt ( curl , CURLOPT_USERAGENT , szuseragent ) ;
return 0 ;
}
//Variables.h
extern const char szuseragent [] ;
//Variables.c
const char szuseragent[]= "My user agent string." ;