paulsm4, fantas
Thanks for the info. If ODE documentation was incorrect, fine (I haven't tested on linux simulations which required 70mb stack). But that's strange why OP get segfault and not stack overflow or compiler warnings.
Anyway, OP's program crashes
during entry of main function. So it looks like it's stack problem after all.
Possible solutions:
1) Use "new" or "malloc" to allocate arrays, maybe together with simple wrapper class that will automatically destroy array when it isn't needed anymore.
2) Allocate array outside of function (so it'll be global variable):
Code:
#include<iostream>
using namespace std;
const int xSize=1024, ySize=768, depth=3;
int graphic[ySize][xSize][depth];
int main(int argc, char *argv[]){
int test=0;
for(int i=0;i<ySize;i++){
for(int j=0;j<xSize;j++){
graphic[i][j][0]=i;
graphic[i][j][1]=j;
graphic[i][j][2]=i+j;
}
}
return test;
}
3) Make array static:
Code:
#include<iostream>
using namespace std;
int main(int argc, char *argv[]){
int test=0;
const int xSize=1024, ySize=768, depth=3;
static int graphic[ySize][xSize][depth];
for(int i=0;i<ySize;i++){
for(int j=0;j<xSize;j++){
graphic[i][j][0]=i;
graphic[i][j][1]=j;
graphic[i][j][2]=i+j;
}
}
return test;
}
All three will work.