You've identified the main problem: undefined reference to _main_
Every C program being built into an application (standalone executable) needs one by definition. This simple one will allow you to build your executable successfully here:
Given the struct is defined as:
typedef struct {
double rgbtRed;
double rgbtGreen;
double rgbtBlue;
}RGBTRIPLE;
RGBTRIPLE image[3][4];//due to the design of sepia, this must be globally defined.
Then the simplest main function that will compiler without error is:
int main(void)
{
sepia(3, 4, image);
return 0;
}
As mentioned in comments, there are some adjustments to the function sepia that are required. For example, that statement:
int sepiaRed = .393 ...
uses an int
type to store double
values. This will compile, but will result in runtime errors. Changing int
to double for all of these statements is a start. But there are other problems as well.
Leave a comment if you would like additional help, or use a debugger to walk through the code to see the errors and make adjustments as needed.
For example, for an uninitialized image
struct, what will be the result of this statement:
double sepiaRed = .393 * image[h][w].rgbtRed + .769 * image[h][w].rgbtGreen + .189 * image[h][w].rgbtBlue;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…