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)
}
//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)
}

For me there are much more errors. Are you shore that you posted the whole code?

class DownSample
{
public:
    Matrix *downSmple(Matrix *Image);
} ; // <----- this ; is MISSING

actaully i didnt paste matrix.h and StdAfx.h files,

Thank You, The Error Was Cleared

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.