Hi all. I've written a program that dynamically allocates memory for a 3dim array, reads a file into that array, does some stuff to the data in the array and then outputs the array to a file.
I can compile my program with Dev-C++ and run it all day long on my laptop (Windows XP). The problem with this is my laptop is slow. So, I tried to compile the code with gcc on my Linux box. gcc, however, doesn't seem to like my code.
The error I get says: "In function `__static_initi alization_and_d estruction_0(in t, int':." Then errors go on for another page or two. I've included the code that makes the array (if I need to include more code, I'll be more than happy).
I know about enough C++ to get done what I need, and am a new Linux user.
Thanks in advance for your help.
I can compile my program with Dev-C++ and run it all day long on my laptop (Windows XP). The problem with this is my laptop is slow. So, I tried to compile the code with gcc on my Linux box. gcc, however, doesn't seem to like my code.
The error I get says: "In function `__static_initi alization_and_d estruction_0(in t, int':." Then errors go on for another page or two. I've included the code that makes the array (if I need to include more code, I'll be more than happy).
I know about enough C++ to get done what I need, and am a new Linux user.
Thanks in advance for your help.
Code:
#include<fstream> #include<iostream> #include<math.h> #include<string> using namespace std; // Voxel information array float ***xyz = NULL; int main() { // Ask user for input file string filename; cout << "File, array size (*.* DIM DIM DIM): "; int numOfVoxelsX; int numOfVoxelsY; int numOfVoxelsZ; cin >> filename >> numOfVoxelsX >> numOfVoxelsY >> numOfVoxelsZ; string outputFileName; cout << endl; cout << "Output File Name (*.*): "; cin >> outputFileName; cout << "Initializing" << endl; xyz = new float**[numOfVoxelsX]; for (i = 0; i<numOfVoxelsX; i++) { xyz[i] = new float*[numOfVoxelsY]; for (j = 0; j<numOfVoxelsY; j++) { xyz[i][j] = new float[numOfVoxelsZ]; } } cout << "Space allocated." << endl; .....
Comment