C++ 3D Array LiDAR Data
<p>I have a comp-sci project at university that has me somewhat stumped.  <a href="http://menehune.opt.wfu.edu/csc221/index.html" rel="nofollow">1</a>[Project Link]This link will take you to the website, and the project is the PDF called "LiDAR Data and 3D arrays".
The basic premise of the project is to be able to read and store data into a 3D char array, and then show the actual data in the format of a picture.  Here is my code that contains the 3 methods we were assigned to write in the class array3d.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;iomanip&gt;
#include &lt;fstream&gt;
using namespace std ;

// -----------------------------------------------------------------
// array3d class with variables for 3D Matrix boundaries, 3D Matrix itself,
// Methods to store data in 3D Matrix, and display LiDAR data

class array3d
{
    private:
    int m, n, p;
    int a, b, c;
    char *** G;
    public:
    array3d();
    ~array3d();
    bool read(char * fname);//Method to read file and store data in 3D    Matrix
    void get_sizes(int &amp; a, int &amp; b, int &amp; c);//Method to fine values of m, n, and p 
    int get_zmap_value(int x, int y);// Method to return highest occupied cell for pos. x, y
};
// -----------------------------------------------------------------
bool array3d::read(char * fname)
{
    //Read the data into a 3D matrix
    ifstream ifs;
    ifs.open(fname);
    if(!ifs.is_open())
    {
        cerr &lt;&lt; "Can not open (read) file '" &lt;&lt; fname &lt;&lt; "'" &lt;&lt; endl;
        return false;
    }
    ifs &gt;&gt; m;
    ifs &gt;&gt; n;
    ifs &gt;&gt; p;
    G = new (nothrow) char **[m];
    for(int i = 0; i &lt; m; i++)
    {
        G[n] = new (nothrow) char *[n];
        for(int j = 0; j &lt; n; j++)
        {
            G[n][p] = new (nothrow) char [p];
            for(int k = 0; k &lt; p; k++)
            {
                ifs &gt;&gt; G[m][n][p];
            }
        }
    }
    ifs.close();
    return true;
}
// -----------------------------------------------------------------
void array3d::get_sizes(int &amp; a, int &amp; b, int &amp; c)
{
    //Get values for m, n, and p using pass-by-reference semantics
    a = m;
    b = n;
    c = p;
}
// -----------------------------------------------------------------
int array3d::get_zmap_value(int x, int y)
{
    //Returns the highest occupied cell (z-index) for pos. x, y in the  ground plane
    for(int z = 0; z &lt; p; z++)
    {
        if(G[x][y][z] == 1)
        {
            return z;
        }
    } 
}
// -----------------------------------------------------------------
</code></pre>

<p>And here is the code for the MakeFile we are also supposed to create</p>

<pre><code>##
## FILE: MakeFile
##
zview:      array3d.o main.o
        g++ -o zview array3d.o main.o -L/user/local/lib -lppm_graphic 
##
array3d.o: array3d.cc
        g++ -c array3d.cc
##
##
clean:
        /bin/rm array3d.o main.o zview
</code></pre>

<p>For the makefile, we have been given the main.o file, but are unable to access it.  Also the library file is in another directory, so we have to access that using a number of different cmd line options.</p>

<p>What ends up happening when I run my code, and do zview, is that it opens the program that is supposed to show pictures, but there is no picture on it, just the title of the picture program and some other options.  Basically, I am not sure what my problem is here, but any help would be appreciated.  Also, please don't just give me the answer, I would like to actually understand why this is not working, so any constructive help would be greatly appreciated.</p>