Probleme de liaison

Signaler
Messages postés
14
Date d'inscription
jeudi 10 février 2005
Statut
Membre
Dernière intervention
15 mars 2006
-
Messages postés
14
Date d'inscription
jeudi 10 février 2005
Statut
Membre
Dernière intervention
15 mars 2006
-
bonjour
j'ai un gros probleme de liaison dans mon programme et je ne sais pas comme la corriger.

(Lieu Erreur) Unresolved external '__fastcall TForm1::FileSaveClick(System::TObject *) referenced D:\...\Main.obj

(Lieu Erreur) Unresolved external '__fastcall TForm1::SaveAsButtonClick(System::TObject *) referenced D:\...\Main.obj

(Lieu Erreur) Unresolved external '__fastcall TForm1::FileNewClick(System::TObject *) referenced D:\...\Main.obj

(Lieu Erreur) Unresolved external 'TCharsetObject::' referenced D:\...\Main.obj

(Lieu Erreur) Unresolved external '__fastcall TCharsetObject::TCharsetObject(int)' referenced D:\...\Main.obj

merci beaucoup et si cela peut vous aider je me suis beaucoup aidé de l'exemple RichEdit de Borland C++ Builder 5

2 réponses

Messages postés
70
Date d'inscription
jeudi 22 mai 2003
Statut
Membre
Dernière intervention
21 décembre 2005

Sans les sources ça va être difficile de t'aider.
Cependant je pense que ton problème vient du fait que les fonctions FileNewClick, SaveAsButtonClick et TCharsetObject sont bien déclarées dans le header mais non pas été implémentées ce qui n'est pas génant tant que ces fonctions ne sont pas appelées.
Et visiblement ton main les appele.
Donc implémentes-les si ce n'est pas le cas.

Si ceci n'a pas résolu ton problème, détaille un peu plus ton programme pour nous faciliter le travail
Messages postés
14
Date d'inscription
jeudi 10 février 2005
Statut
Membre
Dernière intervention
15 mars 2006

voici la source de mon code

//---------------------------------------------------------------------------


#include <vcl.h>
#pragma hdrstop
#include <windows.hpp>
#include <stdlib.h>
#include <stdio.h>
#include "Main.h"
#include "ReConst.hpp"





//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)


{
SetFileName(Reconst_SUntitled);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SelectionChange(TObject */*Sender*/)
{
char sizebuf[6];


try {



SpeedButton2->Down = RichEdit1->SelAttributes->Style.Contains(fsBold);
SpeedButton3->Down = RichEdit1->SelAttributes->Style.Contains(fsItalic);
SpeedButton4->Down = RichEdit1->SelAttributes->Style.Contains(fsUnderline);



FontName->Text = RichEdit1->SelAttributes->Name;



}
catch (...) {
FUpdating = False;
}
FUpdating = False;
}
//----------------------------------------------------------------------------
TTextAttributes *__fastcall TForm1::CurrText(void)
{
return RichEdit1->SelAttributes;
}
//----------------------------------------------------------------------------
int __stdcall EnumFontsProc(TLogFontA &LogFont, TTextMetricA &/*TextMetric*/,
int /*FontType*/, Pointer Data)
{
TCharsetObject *FontCharset;
FontCharset = new TCharsetObject((int)LogFont.lfCharSet);
((TStrings *)Data)->AddObject((AnsiString)LogFont.lfFaceName,FontCharset);
return 1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::GetFontNames(void)
{ HDC hDC = GetDC(0);
void * cTmp = (void *)FontName->Items;
EnumFonts(hDC, NULL, (FONTENUMPROC) EnumFontsProc, (long) cTmp );
ReleaseDC(0,hDC);
FontName->Sorted = True;
}
//----------------------------------------------------------------------------
void __fastcall TForm1::SetFileName(const AnsiString FileName)
{
LPSTR lpBuf = new char[MAX_PATH];
sprintf(lpBuf, Reconst_SPercent_s.c_str(), ExtractFileName(FileName).c_str(),
Application->Title.c_str());
Caption = (AnsiString)lpBuf;
FFileName = FileName;
delete lpBuf;
}
//----------------------------------------------------------------------------
void __fastcall TForm1::CheckFileSave(void)
{ if ( RichEdit1->Modified ) {
switch(MessageBox(Handle, Reconst_SSaveChanges.c_str(),
Reconst_SConfirmation.c_str(),MB_YESNOCANCEL | MB_ICONQUESTION))
{ case ID_YES : FileSaveClick(this);
case ID_CANCEL : Abort();
};
}
}
//----------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject* /*Sender*/)
{
AnsiString asLcid;
int iLcid;


Application->OnHint = &ShowHint;
OpenDialog1->InitialDir = ExtractFilePath(ParamStr(0));
SaveDialog1->InitialDir = OpenDialog1->InitialDir;
GetFontNames();
SelectionChange(this);


}
//----------------------------------------------------------------------------
void __fastcall TForm1::ShowHint(TObject* /*Sender*/)
{ StatusBar1->SimpleText = Application->Hint;
}
//----------------------------------------------------------------------------


void __fastcall TForm1::NewButtonClick(TObject *Sender)
{
CheckFileSave();
SetFileName(Reconst_SUntitled);
RichEdit1->Lines->Clear();
RichEdit1->Modified = False;
}
//---------------------------------------------------------------------------


void __fastcall TForm1::OpenButtonClick(TObject *Sender)
{
CheckFileSave();
if (OpenDialog1->Execute()) {
RichEdit1->Lines->LoadFromFile(OpenDialog1->FileName);
SetFileName(OpenDialog1->FileName);
RichEdit1->SetFocus();
RichEdit1->Modified = False;
RichEdit1->ReadOnly = OpenDialog1->Options.Contains(ofReadOnly);
}
}
//---------------------------------------------------------------------------


void __fastcall TForm1::SaveButtonClick(TObject *Sender)
{
if ( !strcmp(FFileName.c_str(), Reconst_SUntitled.c_str()) )
FileSaveAsClick(Sender);
else
{
RichEdit1->Lines->SaveToFile(FFileName);
RichEdit1->Modified = False;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FileSaveAsClick(TObject* /*Sender*/)
{ if ( SaveDialog1->Execute() ) {
// Options + OverwritePrompt = True thus no need to check.
RichEdit1->Lines->SaveToFile(SaveDialog1->FileName);
SetFileName(SaveDialog1->FileName);
RichEdit1->Modified = False;
}
}


//---------------------------------------------------------------------------


void __fastcall TForm1::PrintButtonClick(TObject *Sender)
{
if ( PrintDialog1->Execute() ) RichEdit1->Print( FFileName );
}
//---------------------------------------------------------------------------


void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
if ( RichEdit1->HandleAllocated() )
SendMessage(RichEdit1->Handle, EM_UNDO, 0, 0);
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Cut1Click(TObject *Sender)
{
RichEdit1->CutToClipboard();
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Copy1Click(TObject *Sender)
{
RichEdit1->CopyToClipboard();
}
//---------------------------------------------------------------------------


void __fastcall TForm1::C1Click(TObject *Sender)
{
RichEdit1->PasteFromClipboard();
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Font1Click(TObject *Sender)
{
FontDialog1->Font->Assign( RichEdit1->SelAttributes );
if ( FontDialog1->Execute() )
CurrText()->Assign( FontDialog1->Font );


RichEdit1->SetFocus();
}
//---------------------------------------------------------------------------



void __fastcall TForm1::SpeedButton2Click(TObject *Sender)
{
if ( !FUpdating )
{ if ( SpeedButton2->Down )
CurrText()->Style = CurrText()->Style << fsBold;
else
CurrText()->Style = CurrText()->Style >> fsBold;
}
}
//---------------------------------------------------------------------------


void __fastcall TForm1::SpeedButton3Click(TObject *Sender)
{
if ( !FUpdating )
{
if ( SpeedButton3->Down )
CurrText()->Style = CurrText()->Style << fsItalic;
else
CurrText()->Style = CurrText()->Style >> fsItalic;
}
}
//---------------------------------------------------------------------------


void __fastcall TForm1::SpeedButton4Click(TObject *Sender)
{
if ( !FUpdating )
{
if ( SpeedButton4->Down )
CurrText()->Style = CurrText()->Style << fsUnderline;
else
CurrText()->Style = CurrText()->Style >> fsUnderline;
}
}
//---------------------------------------------------------------------------
voici pour le Main.cpp

//---------------------------------------------------------------------------


#ifndef MainH
#define MainH
//---------------------------------------------------------------------------
#include <Outline.hpp>
#include <Grids.hpp>
#include
#include <ExtCtrls.hpp>
#include <StdCtrls.hpp>
#include <ComCtrls.hpp>
#include <Menus.hpp>
#include <Dialogs.hpp>
#include <Forms.hpp>
#include <Controls.hpp>
#include <Graphics.hpp>
#include <Classes.hpp>
#include <SysUtils.hpp>
#include <Messages.hpp>
#include <Windows.hpp>
#include <System.hpp>
#include <ToolWin.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // Composants gérés par l'EDI
TMainMenu *MainMenu1;
TMenuItem *File1;
TRichEdit *RichEdit1;
TLabel *Label1;
TSaveDialog *SaveDialog1;
TOpenDialog *OpenDialog1;
TPrintDialog *PrintDialog1;
TMenuItem *New1;
TMenuItem *Save1;
TMenuItem *Saveas1;
TMenuItem *N1;
TMenuItem *Open1;
TMenuItem *Print1;
TMenuItem *N2;
TComboBox *FontName;
TCoolBar *CoolBar1;
TSpeedButton *OpenButton;
TSpeedButton *SaveAsButton;
TSpeedButton *NewButton;
TSpeedButton *SaveButton;
TSpeedButton *PrintButton;
TSpeedButton *SpeedButton1;
TSplitter *Splitter1;
TBevel *Bevel3;
TBevel *Bevel1;
TBevel *Bevel2;
TComboBox *ComboBox1;
TBevel *Bevel4;
TComboBox *ComboBox2;
TSpeedButton *SpeedButton2;
TMenuItem *Exit1;
TBevel *Bevel5;
TSpeedButton *SpeedButton3;
TSpeedButton *SpeedButton4;
TStatusBar *StatusBar1;
TMenuItem *Edit1;
TMenuItem *C1;
TMenuItem *Copy1;
TMenuItem *Cut1;
TMenuItem *N4;
TMenuItem *About1;
TMenuItem *N3;
TMenuItem *Font1;
TFontDialog *FontDialog1;
void __fastcall NewButtonClick(TObject *Sender);
void __fastcall OpenButtonClick(TObject *Sender);
void __fastcall SaveButtonClick(TObject *Sender);
void __fastcall SaveAsButtonClick(TObject *Sender);
void __fastcall PrintButtonClick(TObject *Sender);
void __fastcall SpeedButton1Click(TObject *Sender);
void __fastcall Cut1Click(TObject *Sender);
void __fastcall Copy1Click(TObject *Sender);
void __fastcall C1Click(TObject *Sender);
void __fastcall Font1Click(TObject *Sender);
void __fastcall SpeedButton2Click(TObject *Sender);
void __fastcall SpeedButton3Click(TObject *Sender);
void __fastcall SpeedButton4Click(TObject *Sender);
void __fastcall SelectionChange(TObject *Sender);
void __fastcall FileNewClick(TObject *Sender);
void __fastcall FileOpenClick(TObject *Sender);
void __fastcall FileSaveClick(TObject *Sender);
void __fastcall FileSaveAsClick(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
private: // Déclarations utilisateur
void __fastcall ShowHint(TObject *Sender);
AnsiString FFileName;
bool FUpdating;
int FDragOfs;
bool FDragging;
TTextAttributes *__fastcall CurrText(void);
void __fastcall GetFontNames(void);
void __fastcall SetFileName(const AnsiString FileName);
void __fastcall CheckFileSave(void);
public: // Déclarations utilisateur
virtual __fastcall TForm1(TComponent* Owner);


};
//----------------------------------------------------------------------------
class TCharsetObject : public TObject
{
public:
int Charset;
__fastcall TCharsetObject(int FCharset);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

le Main.h

// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved


// (DO NOT EDIT: machine generated header) 'ReConst.pas' rev: 5.00


#ifndef ReConstHPP
#define ReConstHPP


#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Windows.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit


//-- user supplied -----------------------------------------------------------


namespace Reconst
{
//-- type declarations -------------------------------------------------------
//-- var, const, procedure ---------------------------------------------------
static const Word ENGLISH = 0x409;
static const Word GERMAN = 0x407;
static const Word FRENCH = 0x40c;
extern PACKAGE System::ResourceString _SUntitled;
#define Reconst_SUntitled System::LoadResourceString(&Reconst::_SUntitled)
extern PACKAGE System::ResourceString _SPercent_s;
#define Reconst_SPercent_s System::LoadResourceString(&Reconst::_SPercent_s)
extern PACKAGE System::ResourceString _SSaveChanges;
#define Reconst_SSaveChanges System::LoadResourceString(&Reconst::_SSaveChanges)
extern PACKAGE System::ResourceString _SConfirmation;
#define Reconst_SConfirmation System::LoadResourceString(&Reconst::_SConfirmation)
extern PACKAGE System::ResourceString _SNumberbetween;
#define Reconst_SNumberbetween System::LoadResourceString(&Reconst::_SNumberbetween)
extern PACKAGE System::ResourceString _SLcid;
#define Reconst_SLcid System::LoadResourceString(&Reconst::_SLcid)


} /* namespace Reconst */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Reconst;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx


#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // ReConst

le ReConst.hpp
je crois que c'est cette partie qui ne fonctionne pas car je l'ai prise d'un autre programme (RichEdit l'exemple de Borland 5) et j'ai simplement ajouté le fichier au projet.


mais je ne sais pas comment implémenter les fonctions
j'espere que ca pourra vous aider
merci d'avance