This is my sample code:
#include <iostream>
#include <cstring>
#include <vector>
#include <iterator>
#include "MQmessage.h"
using namespace std;
int main()
{
// declaring an array to store name/value pair
struct Property user_property[15];
const char* const list[] = {"stateCode","errorCode"};
const size_t len = sizeof(list) / sizeof(list[0]);
for (size_t i = 0; i < len; ++i) {
strcpy(user_property[0].name,list[i]);
}
for (size_t i = 0; i < len; ++i) {
std::cout<<user_property[i]<<endl;
}
return 0;
}
I am getting follwoing errors in the code:
no match for 'operator<<' in std::cout
Can someone tell me what is that I am doing wrong?
strcpycall you refer touser_property[0]independent of the value ofi. Also, there are always 15Propertyobjects, independent oflen. Finally, I hope the constructor ofPropertyallocates sufficient space innamefor thestrcpyto work without problems.