Is there any reason why a c++ program that runs perfectly on a 64 bit system crashes on a 32 bit system? I have a program tested on 2 servers. one a 64bit and other 32bit. The program doesnt have bit specific commands. Initially it was working in both until i made a chage and added a structure and called it. The program crashed when this structure object was called for the first time. But if i print the value of the elements 1 line before the crash it, the values are there. Btw, the by value i mean integers and no pointers or other funny stuff.
I tried initiating these integers as uint32_t and such experiments. But to meet a dead end.
the structure is like this
struct info {
int id1, id2;
string test;
};
map<string, info> allInfo
vector<string> temp;
/* temp populated */
info details = {atoi(temp[0].c_str()),atoi(temp[2].c_str()),temp[3].c_str()};
allInfo[temp[1].c_str()] = details;
/*somewhere after this it is accessed */
map<string, info>::iterator i;
/* printing the values here seems ok.. */
cout << (*i).second.id1 << endl << (*i).second.id2 << endl;
string first_id = "idOne : " + (*i).second.id1;
string second_id = "idTwo: " + (*i).second.id2;
There’s multiple things that could go wrong, and without a debugger it’s going to be a nightmare to find out.
Option 1: Convince whoever has admin rights to the server to install
gdb.Option 2: Add print statements everywhere to figure out exactly which line the segfault occurs on a post it here (or try and figure it out from that on your own).