Hi,
I am Mangai, I am working in VC++. When I run my code I get an error like
error C2143: syntax error : missing ';' before '*'
error C2501: missing storage-class or type specifiers
since I am a beginner I couldnt fix it. Can anyone help me in fixing it?


Thanks,
mangai

Hi,
I am Mangai, I am working in VC++. When I run my code I get an error like
error C2143: syntax error : missing ';' before '*'
error C2501: missing storage-class or type specifiers
since I am a beginner I couldnt fix it. Can anyone help me in fixing it?


Thanks,
mangai

So please give the code where the error occurred.

I get similar error sometimes if I did not include the correct header files and something has not been defined. DaniWeb does not allow us to use our crystle balls to see your program so I you will just have to post it.

//DownSample.h
#ifndef __DownSample_h
#define __DownSample_h
#include "matrix.h"

class DownSample
{
public:
    Matrix *downSmple(Matrix *Image);
}
#endif
this is the DownSample.cpp file which I use
#include "StdAfx.h" 
#include "DownSample.h"

Matrix *DownSample::downSmple(Matrix *Image)
{
    int i,j;
    int i1=0;
    int j1=0;
    int width = Image->getNumCols();
    int height = Image->getNumRows();
     Matrix *Image1=New Matrix(width/2,height/2);
   for(i=0;i<height;i=+2)
   {   
    i1++;
    for(j=1;j<width;j=j+2)
    {
        j1++;
        if(i-1<0)
                    Image->getElement(i-1)=Image->getElement(i);
        if(j<=0)
            Image->getElement(j-1)=Image->getElement(j);
                Image1->setElement((Image->getElement(i-1,j-1)+Image->getElement(i-1,j)+Image->getElement(i-1,j+1)+Image->getElement(i,j-1)+Image->getElement(i,j)+Image->getElement(i,j+1)+Image->getElement(i+1,j-1)+Image->getElement(i+1,j)+Image->getElement(i+1,j+1))/9),i,j-1);

    }

   }
   return(Image1)
}

Edited 3 Years Ago by pyTony: fixed formatting

//DownSample.h
#ifndef __DownSample_h
#define __DownSample_h
#include &quot;matrix.h&quot;

class DownSample
{
public:
    Matrix *downSmple(Matrix *Image);
}
#endif
this is the DownSample.cpp file which I use
#include &quot;StdAfx.h&quot; 
#include &quot;DownSample.h&quot;

Matrix *DownSample::downSmple(Matrix *Image)// i get error in this line
{
    int i,j;
    int i1=0;
    int j1=0;
    int width = Image->getNumCols();
    int height = Image->getNumRows();
     Matrix *Image1=New Matrix(width/2,height/2);
   for(i=0;i<height;i=+2)
   {   
    i1++;
    for(j=1;j<width;j=j+2)
    {
        j1++;
        if(i-1<0)
                    Image->getElement(i-1)=Image->getElement(i);
        if(j<=0)
            Image->getElement(j-1)=Image->getElement(j);
                Image1->setElement((Image->getElement(i-1,j-1)+Image->getElement(i-1,j)+Image->getElement(i-1,j+1)+Image->getElement(i,j-1)+Image->getElement(i,j)+Image->getElement(i,j+1)+Image->getElement(i+1,j-1)+Image->getElement(i+1,j)+Image->getElement(i+1,j+1))/9),i,j-1);

    }

   }
   return(Image1)
}
This article has been dead for over six months. Start a new discussion instead.