e2316 ...is not a member of 'Tform1'

Aug 17, 2008 at 8:54am
have the folllowing code and error shows up when i run it. it says that e2316 '__fastcall TForm1::Selectd(float a[], int i,int j,int k)' is not a member of Tform1. anyone knows why i cant run the program?




float __fastcall TForm1::Selectd(float a[], int i,int j,int k) //select median (selection by partition)


{

if(i<=j)
{
int p=Partitiond(a,i,j);
if(p>(k) )
return Selectd(a,i,(p-1),k);
else if (p<(k ) )
return Selectd(a,p+1,j,k);
else
return a[p];
}
}
Aug 17, 2008 at 10:06am
How did you declare it in the class?
Aug 17, 2008 at 4:46pm
not sure what u meant by this is my entire code



//--------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <dir.h>
#include <math.h>


#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "WMPLib_OCX"
#pragma link "imageenview"
#pragma link "imageenproc"
#pragma link "histogrambox"
#pragma link "ieview"
#pragma link "hvideocap"
#pragma link "imageenproc"
#pragma resource "*.dfm"

int a;
int b;
int i;
int j;
int k;
float p[10];
float med;
int h;



TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
ComboBox1->Items->Add("10 Secs");
ComboBox1->Items->Add("20 Secs");
ComboBox1->Items->Add("30 Secs");
ComboBox1->Items->Add("40 Secs");
ComboBox1->Items->Add("50 Secs");
ComboBox1->Items->Add("60 Secs");

FileListBox1->Mask = "";
}
//---------------------------------------------------------------------------
float __fastcall TForm1::Selectd(float a[], int i,int j,int k) //select median (selection by partition)


{

if(i<=j)
{
int p=Partitiond(a,i,j);
if(p>(k) )
return Selectd(a,i,(p-1),k);
else if (p<(k ) )
return Selectd(a,p+1,j,k);
else
return a[p];
}
}
//-----------------------------------------------------------------------------

int __fastcall TForm1::Partitiond(float a[] ,int i,int j)
{
int val=a[i];
int h=i;
for (int k=(i+1);k<=j;k++)
{
if (a[k]<val)
{
h=h+1;
//swap a[h],a[k]
int temp=a[h];
a[h]=a[k];
a[k]=temp;
}
}
//swap a[h],a[i]
int temp=a[h];
a[h]=a[i];
a[i]=temp;

return h;
}


//-----------------------------------------------------------------------------
void __fastcall TForm1::DriveComboBox1Change(TObject *Sender)
{
FileListBox1->Directory = DirectoryListBox1->Directory;
DirectoryListBox1->Drive = FileListBox1->Drive ;

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FilterComboBox1Change(TObject *Sender)
{
FileListBox1->Mask = FilterComboBox1->Mask;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
WindowsMediaPlayer1->URL = FileListBox1->FileName;
WindowsMediaPlayer1->controls->play();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
WindowsMediaPlayer1->close();

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
DriveComboBox1->DirList = DirectoryListBox1;
Button1->Default = true;
FilterComboBox1->Filter = "All files (*.*)|*.*| Video files (*.mpg;*.avi)|*.mpg;*.avi";



Button1->Default = true;

}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button3Click(TObject *Sender)
{

if (RadioButton1->Checked)
{

ImageEnView1->IO->OpenMediaFile( "c:\\incident_0001.mpg" );



a=0;
b=1;
while(a<=299)
{
Timer1-> Interval= 100;
ImageEnView1->IO->LoadFromMediaFile(a);
a++;

ImageEnView1->IO->SaveToFile(StringToOleStr("c:\\"+IntToStr(b)+".jpg"));
b++;
}
ImageEnView1->IO->CloseMediaFile();

}

else
{
Timer1-> Interval= 100;
ImageEnView1->IO->LoadFromMediaFile(a);
a++;
ImageEnView1->IO->SaveToFile(StringToOleStr("c:\\G"+IntToStr(b)+".jpg"));
b++;






ImageEnView1->IO->SaveToFile(StringToOleStr("c:\\G"+IntToStr(b)+".jpg"));
b++;



}


}
//---------------------------------------------------------------------------

Aug 17, 2008 at 10:17pm
I don't see the declaration of TForm1. Is it yours or it's declared in one of those includes?
Aug 17, 2008 at 10:24pm
It is declared in that "Unit1.h" include. He needs to post its code too.
Topic archived. No new replies allowed.