-1

so I keep getting this error despite the fact that I am calling the class correctly if anybody could please help.

void PPM::sepiaFilter( PPM& dst ) const {

    dst.setWidth( this->getWidth( ) );

    dst.setHeight( this->getHeight( ) );

    dst.setMaxColorValue( this->getMaxColorValue( ) );

    double red = 0;

    double green = 0;

    double blue = 0;

    for ( int y = 0; y <= this->getHeight( ); y++ ) {

        for ( int x = 0; x <= this->getWidth( ); x++ ) {

            red = this->getChannel( y, x, 0 );

            green = this->getChannel( y, x, 1 );

            blue = this->getChannel( y, x, 2 );

            double new_red = 0.393 * red + 0.769 * green + 0.189 * blue;

            double new_green = 0.349 * red + 0.686 * green + 0.168 * blue;

            double new_blue = 0.272 * red + 0.534 * green + 0.131 * blue;

            if ( new_red > this->getMaxColorValue( ) ) {

                dst.setChannel( y, x, 0, this->getMaxColorValue( ) );

            }

            if ( new_green > this->getMaxColorValue( ) ) {

                dst.setChannel( y, x, 1, this->getMaxColorValue( ) );

            }

            if ( new_blue > this->getMaxColorValue( ) ) {

                dst.setChannel( y, x, 2, this->getMaxColorValue( ) );

            }

            dst.setChannel( y, x, 0, int ( new_red ) );

            dst.setChannel( y, x, 1, int ( new_green ) );

            dst.setChannel( y, x, 2, int ( new_blue ) );

        }

    }

}

I keep getting this error even though everything looks correct, No matter what I do. I have changed so many things to make this not throw an error and I just continue to throw the same error. If anybody could please help me find the situation so I can gladly move on with my life lol.

here is my .h file.

#ifndef _PPM_H_
#define _PPM_H_


#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>


class PPM {


public:

    PPM( );

    int getWidth( ) const;

    int getHeight( ) const;

    int getMaxColorValue( ) const;

    int getChannel( const int& row, const int& column, const int& channel ) const;

    void setWidth( const int& width );

    void setHeight( const int& height );

    void setMaxColorValue( const int& max_color_value );

    void setChannel( const int& row, const int& column, const int& channel, const int& value );

    int getting_width;

    int rhs_width;

    int rhs;

    int lhs;

    bool operator<(const PPM& rhs);

    bool operator>(const PPM& rhs);

    bool operator==(const PPM& rhs);

    bool operator<=(const PPM& rhs);

    bool operator>=(const PPM& rhs);

    bool operator!=(const PPM& rhs);

    PPM operator+=(const PPM& rhs);

    PPM operator-=(const PPM& rhs);

    PPM operator+(const PPM& rhs) const;

    PPM operator-(const PPM& rhs) const;

    PPM operator*(const PPM& rhs) const;

    PPM operator*=(double d);

    PPM operator/=(double d);

    PPM operator*(double d) const;

    PPM operator/(double d) const;

    void sepiaFilter( PPM& dst ) const;


private:

    int mWidth;

    int mHeight;

    int mMAX_COLOR;

    int mRow;

    int mColumn;

    int mChannel;

    std::vector < int > Pixel;

};

std::ostream& operator << (std::ostream& output, const PPM& Pic_out);

std::istream& operator >> (std::istream &input, PPM& Pic_in);

#endif /* _PPM_H_ */
anthony sottile
  • 61,815
  • 15
  • 148
  • 207
Mychsmit
  • 52
  • 9
  • I don't see the body of constructor anywhere... You should at least initialize all the values of the private variables you got there either inside the constructor or initialize them inside the class itself... If you decide to initialize them inside the class then you can simply declare the constructor as `PPM() = default;`... (Will work with **C++11** and above) – Ruks Oct 18 '18 at 05:32
  • Yeah I totally missed the constructor at the beginning of my .cpp file. Thank you! – Mychsmit Oct 19 '18 at 18:48

1 Answers1

1

Have you implemented constructor in your class you must need a body either in you .h or in cpp file

Rupal
  • 26
  • 2