I have just purchased Borland C++ builder (I know I feel ashamed). I know these are about the .NET framework, but I wondered if you could help?!
I am following the tutorial but I am getting a linking error while compiling.
Here is my code (all of it) and the error:
The error is:
[Linker Error] Unresolved external __fastcall TForm1::HelpIndexExecute(System::TObject *) referenced from C:\BORLAND\PROJECTS\TEXTEDITOR\UNIT1.OBJ
And the .h file:
I am following the tutorial but I am getting a linking error while compiling.
Here is my code (all of it) and the error:
The error is:
[Linker Error] Unresolved external __fastcall TForm1::HelpIndexExecute(System::TObject *) referenced from C:\BORLAND\PROJECTS\TEXTEDITOR\UNIT1.OBJ
Code:
//THE CPP FILE:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::FileNewExecute(TObject *Sender)
{
RichEdit1->Clear();
FileName = "untitled.txt";
StatusBar1->Panels->Items[0]->Text = FileName;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FileOpen1Accept(TObject *Sender)
{
RichEdit1->Lines->LoadFromFile (FileOpen1->Dialog->FileName);
FileName = FileOpen1->Dialog->FileName;
StatusBar1->Panels->Items[0]->Text = FileName;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FileSaveExecute(TObject *Sender)
{
if (FileName == "untitled.txt")
FileSaveAs1->Execute();
else
RichEdit1->Lines->SaveToFile(FileName);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FileSaveAs1BeforeExecute(TObject *Sender)
{
FileSaveAs1->Dialog->InitialDir = ExtractFilePath (FileName);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FileSaveAs1Accept(TObject *Sender)
{
FileName = FileSaveAs1->Dialog->FileName;
RichEdit1->Lines->SaveToFile(FileName);
StatusBar1->Panels->Items[0]->Text = FileName;
}
//---------------------------------------------------------------------------
And the .h file:
Code:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ActnList.hpp>
#include <ActnMan.hpp>
#include <ComCtrls.hpp>
#include <StdActns.hpp>
#include <ActnCtrls.hpp>
#include <ActnMenus.hpp>
#include <ToolWin.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TRichEdit *RichEdit1;
TStatusBar *StatusBar1;
TActionManager *ActionManager1;
TAction *FileNew;
TAction *HelpAbout;
TEditCut *EditCut1;
TEditCopy *EditCopy1;
TEditPaste *EditPaste1;
TFileOpen *FileOpen1;
TFileSaveAs *FileSaveAs1;
TFileExit *FileExit1;
TAction *FileSave;
TActionMainMenuBar *ActionMainMenuBar1;
void __fastcall HelpIndexExecute(TObject *Sender);
void __fastcall FileNewExecute(TObject *Sender);
void __fastcall FileOpen1Accept(TObject *Sender);
void __fastcall FileSaveExecute(TObject *Sender);
void __fastcall FileSaveAs1BeforeExecute(TObject *Sender);
void __fastcall FileSaveAs1Accept(TObject *Sender);
private: // User declarations
public: // User declarations
AnsiString FileName;
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif