New to C++, 317 errors when trying to compile. Help please!

Hi Experts,

As some of you may have guessed from previous posts, I am fairly new to C++. I used to code in JAVA and I am finding it very complicated to code in this language.

I am making a digital image processing program, and I have created 5 cpp and 5 header files. I can email the zipped files if you wish because the question page will not allow me to upload a .zipx file :(

1. read file - reads in image from hard drive (this is used to compile, but since I changed some things no longer works, I figure it has something to do with the other files though..)

2. bilinear interpolation file - performs bilinear interpolation. I am not sure how to call this function, as I need to pass in the input and output image to this file's "main algorithm". Also the header maybe incorrect.

3. mean value scheme file - performs mean value algorithm to reduce the resolution of an image. The header file is empty, as I only need a "main algorithm"; however, same problem as 2, I don't know how to pass in the input and output images into the file's "main"

4. delete scheme file - performs deletion of neighbouring pixels to reduce the resolution of an image. The header file is empty, as I only need a "main algorithm"; however, same problem as 2 and 3, I don't know how to pass in the input and output images into the file's "main"

5. gray scale reduction file - performs quantizaation of the gray scale for the output image. The header file is empty, as I only need a "main algorithm"; however, same problem as 2, 3 and 4, I don't know how to pass in the input and output images into the file's "main"


I am pretty sure that most of the errors will be solved quickly, but I am having alot of trouble finding out specific information on how to solve them.

THanks

Dennis
datopdogg7Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

datopdogg7Author Commented:
read.cpp
#include <iostream>
#include <fstream>
#include <string>
#include "bilinear_interpolation.h"
#include "delete_scheme.h"
#include "mean_value_scheme.h"
#include "gray_level_reduction.h"
 
using namespace std;
 
/*** New Data Types ***/
typedef unsigned char BYTE;
 
// create data structure to hold image
struct PIC
{
    unsigned int nChannel;
    bool InterLeaved;
    unsigned int Width, Height, Maxval;
    BYTE *img;
};
 
//function that loads in the header
bool LoadP5Header(ifstream &infile, PIC &pic)
{
    bool rtv = true;
    char buf[16];
    int bufIndex;
    int width, height, maxval;
 
    infile.read(buf, 2); // get the magic number
    buf[2]='\0';
 
    if(buf[0] == 'P' && buf[1] == '5')
	{
        infile.read(buf, 1);
        while(isspace(buf[0])) // Skip white space(s)
		{
            infile.read(buf,1);
		}
 
        // get width
        bufIndex = 0;
        while(bufIndex < 15 && !isspace(buf[bufIndex]))
		{
            bufIndex++;
            infile.read(buf+bufIndex, 1);
        }
        buf[bufIndex] = NULL;  // null terminated string
        width = atoi(buf);
 
        // get height
        infile.read(buf,1);
        while(isspace(buf[0])) // Skip white space(s)
		{
            infile.read(buf,1);
        }
        bufIndex = 0;
        while(bufIndex < 15 && !isspace(buf[bufIndex]))
		{
            bufIndex++;
            infile.read(buf+bufIndex, 1);
        }
        buf[bufIndex] = NULL;  // null terminated string
        height = atoi(buf);
 
       // get Maxval
		infile.read(buf,1);
        while(isspace(buf[0])) // Skip white space(s)
		{
            infile.read(buf,1);
        }
        bufIndex = 0;
        while(bufIndex < 15 && !isspace(buf[bufIndex]))
		{
            bufIndex++;
            infile.read(buf+bufIndex, 1);
        }
        buf[bufIndex] = NULL;  // null terminated string
        maxval = atoi(buf);
 
		// Skip white space(s)
		infile.read(buf,1);
 
        // set the image information in the struct
        pic.InterLeaved = false;
        pic.Width = width;
        pic.Height = height;
		pic.Maxval = maxval;
 
    }
    else rtv = false;
 
    return rtv;
}; // end of LoadP5Header()
 
//function that accepts an infile object and a PIC Object
//and reads in the PIC object
 
void LoadImage(ifstream &infile, PIC &pic)
{
    infile.read(reinterpret_cast<char *>(pic.img), pic.Width*pic.Height);
}
 
//function that accepts an outstream file and a PIC object to
//and writes the output stream to the PIC object
 
void WritePGM(ofstream & outfile, PIC pic)
{
    outfile << "P5" << endl;
    outfile << pic.Width << " " << pic.Height << endl;
	outfile << pic.Maxval << endl;
 
    outfile.write(reinterpret_cast<char *>(pic.img), pic.Width*pic.Height);
}
 
 
int main()
{  
	int algorithm;
	
	// Prompt user for algorithm
 
	cout<<"What zooming algorithm do you wish to use? Type '1' for delete scheme, '2' for mean value substitution scheme, '3' for bilinear interpolation, '4' for reduction of gray level scheme"<<endl;
	cin>> algorithm;
 
	
	ifstream infile_Pin;                /* input file */
    ofstream outfile_Pout;            /* output file */
    char inFileName_Pin[128]="Bernie1.pgm";            /* input file name */
    char outFileName_Pout[128]="Bernie2.pgm";        /* ouput file name */
	
    PIC Pin;            //source image
    PIC Pout;            //output file
 
    /* open input/output file */
    infile_Pin.open(inFileName_Pin, ios::binary);
    outfile_Pout.open(outFileName_Pout, ios::binary);
 
	/* check input file */
    if(!infile_Pin)
    {
        cout<<"Cannot open input file "<< inFileName_Pin <<endl;
        return 1;
    }
 
    if (LoadP5Header(infile_Pin, Pin)) // load pgm (Pin) image header information
    {
        // allocate the memory for the input image
        //the dimensions of the original
        Pin.img = new BYTE[Pin.Width*Pin.Height];
 
        LoadImage(infile_Pin, Pin);   
 
		// Delete Neighbouring Pixel Scheme
 
		if(algorithm == 1)
		{
			delete_scheme();
 
		}
 
		// Mean Value Scheme
 
		else if(algorithm == 2)
		{
			mean_value_scheme();
		}
 
		// Bilinear Interpolation Scheme
 
		else if(algorithm == 3)
		{
			bilinear_interpolation();
		}
 
		// Reduction of Gray Level Scheme
 
		else if(algorithm == 4)
		{
			gray_level_reduction();
 
		}
 
		// Notify User that the Entered Scheme Doesn't Exist
 
		else
		{
			cout << "Invalid Algorithm Chosen" << endl;
		}  
 
	}
}

Open in new window

0
datopdogg7Author Commented:
read.h
#ifndef read_H
#define read_H
 
#include <iostream>
#include <fstream>
 
using namespace std;
 
/*** New Data Types ***/
 
typedef unsigned char BYTE;
 
// Create Data Structure to Hold Image //
 
typedef struct PIC
{
        unsigned int nChannel;
        bool InterLeaved;
        unsigned int Width, Height, Maxval;
        BYTE *img;
} PIC;
 
bool LoadP5Header(ifstream &infile, PIC &pic);
 
void LoadImage(ifstream &infile, PIC &pic);
 
void WritePGM(ofstream & outfile, PIC pic);
 
#endif

Open in new window

0
datopdogg7Author Commented:
bilinearinterpolation.cpp
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include "read.cpp"
 
using namespace std;	
 
int scale_factor;
 
// Create data structure to hold coordinates of a pixel
 
struct PIXEL
{
	unsigned int vertical, horizontal;
};
 
//Prompt user for scale factor
 
int get_scale()
{
 
	cout<<"What is the factor you wish to zoom by?"<<endl;
	cin>> scale_factor;
 
}
 
// Initialize the output image
 
void set_output_image()
{
	unsigned int Npixels;
	
	// Allocate memory for output images
 
	Pout.nChannel = 1;
	Pout.InterLeaved = false;
 
	// Check to see if the scale factor invokes a dimension that isn't an integer, if so, modify to get a dimension that is an integer
	
	if(Pin.Width%scale_factor != 0)
	{
		Pout.Width = (Pin.Width + scale_factor-1) / scale_factor;
	}
	else
	{
		Pout.Width = Pin.Width / scale_factor;
	}
 
	if(Pin.Height%scale_factor != 0)
	{
		Pout.Height = (Pin.Height + scale_factor-1)/ scale_factor;
	}
	else
	{
		Pout.Height = Pin.Height / scale_factor;
	}
 
	Pout.Maxval = Pin.Maxval;
 
	Npixels = Pout.Width*Pout.Height;
	Pout.img = new BYTE [Npixels];
 
}
 
// Determine the pixel value of the new image based on the original images' pixel values
 
unsigned int get_pixel_value()
{
 
		PIXEL current_pix;
		PIXEL lower_right;
		PIXEL lower_left;
		PIXEL upper_right;
		PIXEL upper_left;
 
		current_pix.horizontal = Pin.Width * (src_x_coord / Pout.Width);
		current_pix.vertical = Pin.Height * (src_y_coord / Pout.Height);
	 
		/* determine 4 source image pixels : (ignore pixels outside of the borders !) */
 
		/* lower right */
 
		lower_right.horizontal = (double)(int)(current_pix.horizontal);     
		lower_right.vertical = (double)(int)(current_pix.vertical);
		
		/* lower left */
 
		lower_left.horizontal = lower_right.horizontal - 1;
		lower_left.vertical = lower_right.vertical;
 
		/* upper right */
 
		upper_right.horizontal = lower_right.horizontal;  
		upper_right.vertical = lower_right.vertical - 1;	
 
		/* upper left */
 
		upper_left.horizontal = lower_right.horizontal - 1;
		upper_left.vertical = lower_right.vertical - 1;     
	 
		horizontal_distance = current_pix.horizontal - (lower_right.horizontal - 0.5);
		vertical_distance  = current_pix.vertical - (lower_right.vertical - 0.5);
	 
		/* calculate weights : */
 
		/* lower right */
		wlr = horizontal_distance * vertical_distance;  
 
		/* lower left */
		wll = (1 - horizontal_distance) * vertical_distance;  
 
		/* upper right */
		wur = horizontal_distance * (1 - vertical_distance); 
 
		/* upper left */
		wul = (1 - horizontal_distance) * (1 - vertical_distance);        
	 
		/* calculate gray value using weighted sum : */
		 return(wlr * Pin.img[lower_right.horizontal*lower_right.vertical] + wll * Pin.img[lower_left.horizontal*lower_left.vertical] + wur * Pin.img[upper_right.horizontal*upper_right.vertical] + wul * Pin.img[upper_left.horizontal*upper_left.vertical]);
 
}
 
// This performs bilinear interpolation on the original image to produce a new scaled image 
 
void interpolate()
{
 
	unsigned int src_x_coord, src_y_coord, horizontal_distance, vertical_distance, wlr, wll, wul, wur, i;
	src_x_coord = 0;
	src_y_coord = 0;
 
	for(i = 0; i < Npixels; i++)
	{
		if(i%Pin.Width == 0)
		{
			src_x_coord = 0;
		}
 
		if(i%Pin.Height == 0)
		{
			src_y_coord = 0;
		}
 
		Pout.img[i] = get_pixel_value()
 
		src_x_coord++;
		src_y_coord++;
	}
 
    WritePGM(outfile_Pout, Pout);
}
 
int main()
{
 
	get_scale();
 
	interpolate();
 
 
}

Open in new window

0
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

datopdogg7Author Commented:
bilinearinterpolation.h
#ifndef bilinear_interpolation_H
#define bilinear_interpolation_H
 
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include "read.cpp"
 
using namespace std;
 
/*** New Data Types ***/
 
typedef struct PIXEL
{
	unsigned int horizontal, vertical;
 
} PIXEL;
 
int get_scale();
 
void set_output_image();
 
unsigned int get_pixel_value();
 
void interpolate();
 
 
 
#endif

Open in new window

0
datopdogg7Author Commented:
delete_scheme.cpp
the header file is empty at the moment...
int main()
{
 
	unsigned int Npixels;
 
	// Prompt user for scale factor
 
	cout<<"What is the factor you wish to zoom by?"<<endl;
	cin>> scale_factor;
 
	// Allocate memory for output images
 
	Pout.nChannel = 1;
	Pout.InterLeaved = false;
 
	if(Pin.Width%scale_factor != 0)
	{
		Pout.Width = (Pin.Width + scale_factor-1) / scale_factor;
	}
	else
	{
		Pout.Width = Pin.Width / scale_factor;
	}
 
	if(Pin.Height%scale_factor != 0)
	{
		Pout.Height = (Pin.Height + scale_factor-1)/ scale_factor;
	}
	else
	{
		Pout.Height = Pin.Height / scale_factor;
	}
 
	Pout.Maxval = Pin.Maxval;
 
	Npixels = Pout.Width*Pout.Height;
	Pout.img = new BYTE [Npixels];
 
	int i;
	unsigned int col;
	unsigned int row;
	i = 0;
	row = 0;
 
	for(row=0; row < Pin.Height; (row = row + scale_factor))
	{
		for(col=0; col < Pin.Width; (col = col + scale_factor))
		{
 
			Pout.img[i] = Pin.img[(row*Pin.Width + col)];
			i++;
 
		}				
 
	}		
 
    WritePGM(outfile_Pout, Pout);
 
}

Open in new window

0
datopdogg7Author Commented:
mean_value_scheme.cpp
header file is empty..
int main()
{
	unsigned int Npixels;
	
	//  Prompt user for scale factor
 
	cout<<"What is the factor you wish to zoom by?"<<endl;
	cin>> scale_factor;
 
	// Allocate memory for output images
 
	Pout.nChannel = 1;
	Pout.InterLeaved = false;
 
	// Check to see if the scale factor invokes a dimension that isn't an integer, if so, modify to get a dimension that is an integer
 
	if(Pin.Width%scale_factor != 0)
	{
		// Set width of output image
 
		Pout.Width = (Pin.Width + scale_factor-1) / scale_factor;
	}
	else
	{
		// Set width of output image
 
		Pout.Width = Pin.Width / scale_factor;
	}
 
	// Check to see if the scale factor invokes a dimension that isn't an integer, if so, modify to get a dimension that is an integer.
 
	if(Pin.Height%scale_factor != 0)
	{
		// Set height of output image
 
		Pout.Height = (Pin.Height + scale_factor-1)/ scale_factor;
	}
	else
	{
		// Set height of output image
 
		Pout.Height = Pin.Height / scale_factor;
	}
 
	Pout.Maxval = Pin.Maxval;
 
	Npixels = Pout.Width*Pout.Height;
	Pout.img = new BYTE [Npixels];
 
	int i;
	unsigned int col;
	unsigned int row;
	i = 0;
	row = 0;
 
	for(row=0; row < Pin.Height; (row = row + scale_factor))
	{
		for(col=0; col < Pin.Width; (col = col + scale_factor))
		{
			
			// Check to see where in the image the algorithm is
 
			if(col == 0)
			{
				// Dealing with left corner case
 
				// Check to see how high the pixel is
 
				if(row == 0)
				{
 
					// Top left (2 adjacent neighbours)
				}
 
				else if(row == Pin.Height)
				{
					// Bottom left (2 adjacent neighbours)
				}
 
				else
				{
					// Somewhere in the middle left (3 adjacent neighbours)
 
				}
 
			}
			
			else if(col == Pin.Width)
			{
				// Dealing with right corner case
 
				// Check to see how high the pixel is
										
				if(row == 0)
				{
					// Top right (2 adjacent neighbours)
				}
 
				else if(row == Pin.Height)
				{
					// Bottom right (2 adjacent neighbours)
				}
 
				else
				{
					// Somewhere in the middle right (3 adjacent neighbours)
				}
 
			}
 
			else
			{
 
				// Dealing with a pixel in the middle
 
				// Check to see how high the pixel is
 
				if(row == 0)
				{
					// Top middle (3 adjacent neighbours)
				}
 
				else if(row == Pin.Height)
				{
					// Bottom middle (3 adjacent neighbours)
				}
 
				else
				{
					// Somewhere in the middle of the image (4 adjacent neighbours)
				}
 
			}
 
			Pout.img[i] = Pin.img[(row*Pin.Width + col)];
			i++;
 
		}				
 
	}
 
    WritePGM(outfile_Pout, Pout);
 
}

Open in new window

0
datopdogg7Author Commented:
gray scale reduction.cpp
header file is empty...
int main()
{
 
	unsigned int Npixels;
 
	// Prompt user for reduction factor
 
	cout<<"What is the factor you wish to reduce the gray levels by?"<<endl;
	cin>> scale_factor;
 
	// Allocate memory for output images
 
	Pout.nChannel = 1;
	Pout.InterLeaved = false;
	Pout.Width = Pin.Width;
	Pout.Height = Pin.Height;
 
	Pout.Maxval = (unsigned int)(Pin.Maxval/scale_factor);
 
	Npixels = Pout.Width*Pout.Height;
	Pout.img = new BYTE [Npixels];
 
	unsigned int i = 0;
 
	for( i = 0; i < Npixels; i++)
	{
 
		Pout.img[i] = (unsigned int)(Pin.img[i]/scale_factor)*scale_factor;
 
	}
 
    WritePGM(outfile_Pout, Pout);
 
}

Open in new window

0
datopdogg7Author Commented:
These are a few of the errors which I believe have to do with the improper calling of the cpp files

 error C3861: 'delete_scheme': identifier not found
error C3861: 'mean_value_scheme': identifier not found
error C3861: 'bilinear_interpolation': identifier not found
 error C3861: 'gray_level_reduction': identifier not found
0
datopdogg7Author Commented:
Thanks evilrix, it has been uploaded
0
AndyAinscowFreelance programmer / ConsultantCommented:
Based on the error I guess you haven't used a
#include "PutFileWhere__delete_scheme__IsDefinedHere"
in the .cpp (or possibly .h) file for each of the errors.


ps. In my experience curing one error can often cure many others simultaneously, especially when missing an include file
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Let_Me_BeCommented:
I give you a simple solution you don't want to hear. Don't code in C++. Unlike Java, its not a language you can just start coding in. It requires deep knowledge of many coding aspects (even beyond C++ syntax).

If you want to pass values back to the caller, you can do that as return value (as pointer if you allocate new object on heap in the function, or as value - make sure your data type is doing deep copy) or as a parameter of the function (reference prefered in this case).
struct Coord { int x; int y; };
 
Coord return_func1() { }
 
void return_func2(Coord& c) {}
 
int main()
{
    Coord c = return_func1();
    return_func2(c);
}

Open in new window

0
mrjoltcolaCommented:
>>I give you a simple solution you don't want to hear. Don't code in C++.

This is the C++ zone, however, and that is not a simple solution.

C++ is probably _the_ most appropriate language for digital image processing.

I don't agree that C++ is an order of magnitude "harder" than Java. Java is, by no means, an easy language.
0
datopdogg7Author Commented:
So I have got a few responses, none of which has been a concrete line of code that solves any of the errors that are appearing... the only thing I have gotten is that I should code in a different language, which is not very helpful...
0
mrjoltcolaCommented:
Noone can give you a concrete line of code because you did not include a full error report with filenames of the compiler output. The errors you provided are an excerpt of one of the 7 files you posted.

I recommend trying to compile 1 file at a time and see what happens.

In Visual Studio, right click on the given .cpp file and choose "Compile" from the menu. Then we can help you incrementally, although this is a lot of code to debug. :)
0
datopdogg7Author Commented:
Sure, here is the bilinear interpolation error report. I am sure alot of the errors have to do with the lack of header file information, but I have gotten no advice or code to put in the header file. Also, I loaded the files on to the website evilrix suggested, so it would be easier to debug that way...

read.cpp(159) : error C3861: 'delete_scheme': identifier not found
read.cpp(167) : error C3861: 'mean_value_scheme': identifier not found
read.cpp(174) : error C3861: 'bilinear_interpolation': identifier not found
read.cpp(181) : error C3861: 'gray_level_reduction': identifier not found
read.cpp(16) : error C2011: 'PIC' : 'struct' type redefinition
read.cpp(16) : see declaration of 'PIC'
read.cpp(25) : error C2084: function 'bool LoadP5Header(std::ifstream &,PIC &)' already has a body
read.cpp(24) : see previous definition of 'LoadP5Header'
read.cpp(86) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(86) : error C2228: left of '.InterLeaved' must have class/struct/union
read.cpp(87) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(87) : error C2228: left of '.Width' must have class/struct/union
read.cpp(88) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(88) : error C2228: left of '.Height' must have class/struct/union
read.cpp(89) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(89) : error C2228: left of '.Maxval' must have class/struct/union
read.cpp(101) : error C2084: function 'void LoadImage(std::ifstream &,PIC &)' already has a body
read.cpp(100) : see previous definition of 'LoadImage'
read.cpp(102) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(102) : error C2228: left of '.img' must have class/struct/union
read.cpp(102) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(102) : error C2228: left of '.Width' must have class/struct/union
read.cpp(102) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(102) : error C2228: left of '.Height' must have class/struct/union
read.cpp(109) : error C2084: function 'void WritePGM(std::ofstream &,PIC)' already has a body
read.cpp(108) : see previous definition of 'WritePGM'
read.cpp(111) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(111) : error C2228: left of '.Width' must have class/struct/union
read.cpp(111) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(111) : error C2228: left of '.Height' must have class/struct/union
read.cpp(112) : error C2027: use of undefined type 'PIC'
\read.cpp(16) : see declaration of 'PIC'
read.cpp(112) : error C2228: left of '.Maxval' must have class/struct/union
read.cpp(114) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(114) : error C2228: left of '.img' must have class/struct/union
read.cpp(114) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(114) : error C2228: left of '.Width' must have class/struct/union
read.cpp(114) : error C2027: use of undefined type 'PIC'
read.cpp(16) : see declaration of 'PIC'
read.cpp(114) : error C2228: left of '.Height' must have class/struct/union
read.cpp(119) : error C2084: function 'int main(void)' already has a body
read.cpp(118) : see previous definition of 'main'
read.cpp(133) : error C2079: 'Pin' uses undefined struct 'PIC'
read.cpp(134) : error C2079: 'Pout' uses undefined struct 'PIC'
read.cpp(147) : error C3861: 'LoadP5Header': identifier not found
read.cpp(151) : error C2228: left of '.img' must have class/struct/union
read.cpp(151) : error C2228: left of '.Width' must have class/struct/union
read.cpp(151) : error C2228: left of '.Height' must have class/struct/union
read.cpp(153) : error C3861: 'LoadImage': identifier not found
read.cpp(159) : error C3861: 'delete_scheme': identifier not found
read.cpp(167) : error C3861: 'mean_value_scheme': identifier not found
read.cpp(174) : error C3861: 'bilinear_interpolation': identifier not found
1>c:\users\kyron\documents\school\ensc 460\assignments\assignment 1\assignment_1\assignment_1\read.cpp(181) : error C3861: 'gray_level_reduction': identifier not found
bilinear_interpolation.cpp(14) : error C2011: 'PIXEL' : 'struct' type redefinition
bilinear_interpolation.h(15) : see declaration of 'PIXEL'
bilinear_interpolation.cpp(36) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(36) : error C2228: left of '.nChannel' must have class/struct/union
bilinear_interpolation.cpp(37) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(37) : error C2228: left of '.InterLeaved' must have class/struct/union
bilinear_interpolation.cpp(41) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(41) : error C2228: left of '.Width' must have class/struct/union
bilinear_interpolation.cpp(43) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(43) : error C2228: left of '.Width' must have class/struct/union
bilinear_interpolation.cpp(43) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(43) : error C2228: left of '.Width' must have class/struct/union
bilinear_interpolation.cpp(47) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(47) : error C2228: left of '.Width' must have class/struct/union
bilinear_interpolation.cpp(47) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(47) : error C2228: left of '.Width' must have class/struct/union
bilinear_interpolation.cpp(50) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(50) : error C2228: left of '.Height' must have class/struct/union
bilinear_interpolation.cpp(52) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(52) : error C2228: left of '.Height' must have class/struct/union
bilinear_interpolation.cpp(52) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(52) : error C2228: left of '.Height' must have class/struct/union
bilinear_interpolation.cpp(56) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(56) : error C2228: left of '.Height' must have class/struct/union
bilinear_interpolation.cpp(56) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(56) : error C2228: left of '.Height' must have class/struct/union
bilinear_interpolation.cpp(59) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(59) : error C2228: left of '.Maxval' must have class/struct/union
bilinear_interpolation.cpp(59) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(59) : error C2228: left of '.Maxval' must have class/struct/union
bilinear_interpolation.cpp(61) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(61) : error C2228: left of '.Width' must have class/struct/union
bilinear_interpolation.cpp(61) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(61) : error C2228: left of '.Height' must have class/struct/union
bilinear_interpolation.cpp(62) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(62) : error C2228: left of '.img' must have class/struct/union
bilinear_interpolation.cpp(71) : error C2079: 'current_pix' uses undefined struct 'PIXEL'
bilinear_interpolation.cpp(72) : error C2079: 'lower_right' uses undefined struct 'PIXEL'
bilinear_interpolation.cpp(73) : error C2079: 'lower_left' uses undefined struct 'PIXEL'
bilinear_interpolation.cpp(74) : error C2079: 'upper_right' uses undefined struct 'PIXEL'
bilinear_interpolation.cpp(75) : error C2079: 'upper_left' uses undefined struct 'PIXEL'
bilinear_interpolation.cpp(77) : error C2228: left of '.horizontal' must have class/struct/union
bilinear_interpolation.cpp(77) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(77) : error C2228: left of '.Width' must have class/struct/union
bilinear_interpolation.cpp(77) : error C2065: 'src_x_coord' : undeclared identifier
bilinear_interpolation.cpp(77) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(77) : error C2228: left of '.Width' must have class/struct/union
bilinear_interpolation.cpp(78) : error C2228: left of '.vertical' must have class/struct/union
bilinear_interpolation.cpp(78) : error C2065: 'Pin' : undeclared identifier
bilinear_interpolation.cpp(78) : error C2228: left of '.Height' must have class/struct/union
bilinear_interpolation.cpp(78) : error C2065: 'src_y_coord' : undeclared identifier
bilinear_interpolation.cpp(78) : error C2065: 'Pout' : undeclared identifier
bilinear_interpolation.cpp(78) : error C2228: left of '.Height' must have class/struct/union
bilinear_interpolation.cpp(84) : error C2228: left of '.horizontal' must have class/struct/union
bilinear_interpolation.cpp(84) : error C2228: left of '.horizontal' must have class/struct/union
bilinear_interpolation.cpp(85) : error C2228: left of '.vertical' must have class/struct/union
bilinear_interpolation.cpp(85) : fatal error C1003: error count exceeds 100; stopping compilation
0
mrjoltcolaCommented:
Right away I see a problem, you are #including a  .cpp file

>>#include "read.cpp"

Usually .cpp are definition files, not include files. You normally only #include .h files. Its not illegal, but in this case, read.cpp is your main file, because you have a main() function. You can only have one single main() per whole program, regardless of how many .cpp files is in the program. main() is where your program starts.

I think this is a typo, and should be #include "read.h" in all files, because I see nowhere even in read.cpp that you are including read.h

0
datopdogg7Author Commented:
Ok, I included the "read.h" in all the files and that got rid of 37 errors.

So what should I do since I have 5 main routines? I want read to have the main algorithm, as demonstrated in the code, but I want to call upon those other files. Do I have to create an instance of each .cpp file? I am trying to understand this like JAVA...
0
mrjoltcolaCommented:
How did you arrive at 5 main() routines in the first place?

5 mains is like 5 classes with static Main() in Java, there is no simple way to "call" it. You have 5 different programs. I would assume you would not write it this way in Java either. You'd have one static main, and 5 subroutines or classes that do different things. Main() will call one of them.

As well, a typical C++ project has only 1 main, so you are going to have to figure out what you are trying to accomplish. If each main() represents a different option, or variation of a theme, you probably should combine all of the mains into one, and use command line options to choose between the function that is called. Otherwise, each file needs to be compiled separately into its own program.

I'm sorry, I'm running out of time for this, hopefully someone else will pitch in. This is more than just a simple question, you really need to spend some time studying C++ and program design. It is a lot to ask for us to resolve your errors line by line for 5 separate programs.

0
mrjoltcolaCommented:
Another idea, limit your problem to a single program. Choose one specific main() to get working first. That will make it easier for you to learn as well as manage the overwhelming feeling of so many errors.
0
datopdogg7Author Commented:
Hi,
Yes I only need to be shown how to get one function to work. The main routine I want is to be in "read.cpp".  This main calls upon various algorithms, which are the other .cpp files included.

In JAVA, I would create an instance of a class and pass the necessary variables through. Do I have to do the same thing here? I will be able to do the other .cpp files if I can get one to work, so starting with the easiest one, how would I do the "gray _scale" cpp file and header?
0
AndyAinscowFreelance programmer / ConsultantCommented:
Another minor point - the first comment by an expert aimed at the question suggested that missing #includes were partly to blame.  When the questioner eventually tried that (after first saying nothing useful was posted) it cleared up a number (37) of the errors.

IMHO some of the comments have helped the questioner considerably and actively solved numbers of the problems.
0
datopdogg7Author Commented:
sorry I was away for a while. the comments suggested by evilrix are fine.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.