Dear i need your help very urgently.
Before this program was running without any error but now it is giving this error Error: Run-Time Check failure #2 stack around the variable "all_variables" was corrupted
Here is the code, i try to debug, it gives this error at the end of this function when it return value.
Even i try at another machine but the error was same. I am using VS2008
Thanks in advance.
SubSets MMPCbar::computeSubSets(std::vector<int> CpcList)
{
//! To calculate all subsets
//! First create plVariablesConjunction of all variables
//! then by using plValues object, iterate all possible combinations
//! of the form 01011. corresponding to 1 store variable index in the combination list
//! at the end put all these combinations in another list.
SubSets subSetsCPC;
vector< int > combinations;
plVariablesConjunction all_variables;
// if Cpc list is empty then return empty set
if (CpcList.size()==0)
{
subSetsCPC.push_back(CpcList);
return subSetsCPC;
}
// If list not empty then calculate subsets
for (int i = 0; i < CpcList.size(); i++)
{
//cout<<" "<< CpcList[i];
std::ostringstream symbol_name;
symbol_name << CpcList.at(i);
plSymbol symbol(symbol_name.str(), plIntegerType(0,1));
all_variables = all_variables ^ symbol;
}
plValues vals(all_variables);
vals.reset();
do {
//cout<<"\n";
for (unsignedint j = 0; j < CpcList.size(); j++)
{
if(vals[j] == 1) // combination will be in the form of 011011, corresponding to 1 add variable in the combination.
{
//cout<<" "<< CpcList[j];
combinations.push_back(CpcList.at(j));
}
}
subSetsCPC.push_back(combinations);
combinations.clear(); // reset list
}while (vals.next());
return subSetsCPC;
}
But others are the classes of the ProBT library.
class PL_DLL_API plVariablesConjunction : public plSampleSpaceObject
class PL_DLL_API plValues : public plSampleSpaceObject
class PL_DLL_API plIntegerType: public plDiscreteType
In VS2005, In Debugger > Exceptions, you can enable breakpoints for each type of exception. If you have that in VS2008, try enabling all exception breakpoints and see if it stops earlier to give you a clue
Last time i had this kind of error, I had different struct member alignment in 2 libs of a project, so a structure had not the same time in one or the other, causing memory overflows