Answer the question
In order to leave comments, you need to log in
Can Visual C++ limit the number of global variables?
Here is the actual code that the studio complains about with this error: error C2078: too many initializers.
#pragma once
#include "HTTPClient.h"
using namespace HTTP;
static char *General[GENERAL_COUNT_HEADERS] =
{
"CacheControl",
"Connection",
"Date",
"MIMEVersion",
"Pragma",
"Trailer",
"TransferEncoding",
"Upgrade",
"Via",
"Warning"
};
static char *Request[REQUEST_COUNT_HEADERS] =
{
"Accept",
"AcceptCharset",
"AcceptEncoding",
"AcceptLanguage",
"Authorization",
"ContentDispositionRq",
"Expect",
"From",
"Host",
"IfMatch",
"IfModifiedSince",
"IfNoneMatch",
"IfRange",
"IfUnmodifiedSince",
"MaxForwards",
"ProxyAuthorization",
"Range",
"Refer",
"TE",
"UserAgent"
};
static char *Response[RESPONSE_COUNT_HEADERS] =
{
"AcceptRanges",
"Age",
"Alternates",
"ContentDispositionRs",
"ETag",
"Location",
"ProxyAuthenticate",
"Public",
"RetryAfter",
"Server",
"Vary",
"WWWAuthenticate"
};
static char Entity[ENTITY_COUNT_HEADERS] =
{
"ContentDispositionE",
"ContentEncoding",
"ContentLanguage",
"ContentLength",
"ContentLocation",
"ContentMD5",
"ContentRange",
"ContentType",
"ContentVersion",
"DerivedFrom",
"Expires",
"LastModified",
"Link",
"Title"
};
HTTPClient::HTTPClient(int a)
{
a=a;
};
int HTTPClient::Header(GeneralHeaders header, char *value)
{
cout << General[header] << ": " << value << endl;
return 0;
};
int HTTPClient::Header(RequestHeaders header, char *value)
{
cout << Request[header] << ": " << value << endl;
return 0;
};
/*int HTTPClient::Request(HTTPClient::Headers header)
{
return 0;
}*/;
HTTPClient::~HTTPClient(void)
{
};
Answer the question
In order to leave comments, you need to log in
You can either write to Microsoft to treat char as a string, or just write char* as done in arrays above.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question