c++ builder 问题跪求帮助。急!!!!!!!!!!!!!!!!
linker error:unresolved external 'tfmlogin:: 'referenced from D:\program\daima\MAIN.OBJ
linker error:unresolved external '__fastcall TfmLogin::TfmLogin(Classess::TComponent ) 'referenced from D:\program\daima\MAIN.OBJ
这个错误我怎么改呀!!!急呀!!!
我是一个超级大生手,请您不要含乎的说出办法,请您一定要详细地给我讲讲怎么才能改正这个错误吧!!!!感谢感谢再感谢!!!!
为了应付毕业论文没办法呀!!
main.cpp
#include <vcl.h>
#pragma hdrstop
#include "Main.h "
#include "login.h "
#include "medinfo.h "
#include "feeinfo.h "
#include "reg.h "
#include "calfee.h "
#include "pay.h "
#include "getmed.h "
#include "ghquery.h "
#include "querystock.h "
#pragma package(smart_init)
#pragma resource "*.dfm "
TfmMain *fmMain;
__fastcall TfmMain::TfmMain(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TfmMain::FormCreate(TObject *Sender)
{
TfmLogin *pForm = new TfmLogin(Application);
pForm-> ShowModal();
if(pForm-> m_szUserCode.IsEmpty())
// 取消了,退出程序
{
Application-> Terminate();
}
else
{
m_szUserCode = pForm-> m_szUserCode;
m_szUserName = pForm-> m_szUserName;
}
delete pForm;
}
TForm* TfmMain::FormExist(AnsiString szCaption)
{
for(int i=0; i <this-> MDIChildCount; i++)
{
TForm *pForm = this-> MDIChildren[i];
if(pForm-> Caption == szCaption)
return pForm; // 已存在窗体,返回该窗体
}
return NULL; // 不存在窗体,返回空值
}
void __fastcall TfmMain::mnuExitClick(TObject *Sender)
{
Application-> Terminate();
}
void __fastcall TfmMain::Label1Click(TObject *Sender)
{
// 查找相应按钮对应的菜单,通过菜单执行相应的操作
for(int i = 0; i < MainMenu1-> Items-> Count; i++)
{
TMenuItem* pItem = MainMenu1-> Items-> Items[i];
TMenuItem* pItem1 = pItem-> Find(
((TLabel*) Sender)-> Caption);
if(pItem1) pItem1-> Click();
}
}
void __fastcall TfmMain::mnuMedInfoClick(TObject *Sender)
{
// 药品信息维护
TForm *pForm = FormExist( "药品信息维护 ");
// 如果已存在则激活,否则新建一个字窗体
if(pForm)
pForm-> SetFocus();
else
pForm = new TfmMedInfo(Application);
pForm-> Show();
}
void __fastcall TfmMain::mnuFeeInfoClick(TObject *Sender)
{
// 收费项目维护
TForm *pForm = FormExist( "收费项目维护 ");
// 如果已存在则激活,否则新建一个字窗体
if(pForm)
pForm-> SetFocus();
else
pForm = new TfmFeeInfo(Application);
pForm-> Show();
}
void __fastcall TfmMain::mnuRegClick(TObject *Sender)
{
// 门诊挂号管理
TForm *pForm = FormExist( "门诊挂号管理 ");
// 如果已存在则激活,否则新建一个字窗体
if(pForm)
pForm-> SetFocus();
else
pForm = new TfmReg(Application);
pForm-> Show();
}
void __fastcall TfmMain::mnuCalClick(TObject *Sender)
{
// 门诊划价管理
TForm *pForm = FormExist( "门诊划价管理 ");
// 如果已存在则激活,否则新建一个字窗体
if(pForm)
pForm-> SetFocus();
else
pForm = new TfmCalFee(Application);
pForm-> Show();
}
void __fastcall TfmMain::mnuPayClick(TObject *Sender)
{
// 门诊收费管理
TForm *pForm = FormExist( "门诊收费管理 ");
// 如果已存在则激活,否则新建一个字窗体
if(pForm)
pForm-> SetFocus();
else
pForm = new TfmPay(Application);
pForm-> Show();
}
void __fastcall TfmMain::mnuGetMedClick(TObject *Sender)
{
// 门诊发药管理
TForm *pForm = FormExist( "门诊发药管理 ");
// 如果已存在则激活,否则新建一个字窗体
if(pForm)
pForm-> SetFocus();
else
pForm = new TfmGetMed(Application);
pForm-> Show();
}
void __fastcall TfmMain::mnuQueryRegClick(TObject *Sender)
{
// 门诊挂号统计
TForm *pForm = FormExist( "门诊挂号统计 ");
// 如果已存在则激活,否则新建一个字窗体
if(pForm)
pForm-> SetFocus();
else
pForm = new TfmQueryGH(Application);
pForm-> Show();
}
void __fastcall TfmMain::mnuMedStockClick(TObject *Sender)
{
// 药品库存查询
TForm *pForm = FormExist( "药品库存查询 ");
// 如果已存在则激活,否则新建一个字窗体
if(pForm)
pForm-> SetFocus();
else
pForm = new TfmQuerySTK(Application);
pForm-> Show();
}
main.h
#ifndef MainH
#define MainH
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Menus.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
class TfmMain : public TForm
{
__published:// IDE-managed Components
TMainMenu *MainMenu1;
TMenuItem *mnuInfo;
TMenuItem *mnuBook;
TMenuItem *mnuReg;
TMenuItem *mnuMedInfo;
TMenuItem *mnuFeeInfo;
TMenuItem *mnuCal;
TMenuItem *mnuQuery;
TMenuItem *mnuQueryReg;
TMenuItem *mnuMedStock;
TMenuItem *mnuExit;
TLabel *Label1;
TLabel *Label2;
TLabel *Label4;
TLabel *Label5;
TLabel *Label7;
TLabel *Label9;
TLabel *Label10;
TBevel *Bevel1;
TBevel *Bevel3;
TBevel *Bevel4;
TLabel *Label11;
TLabel *Label12;
TLabel *Label13;
TLabel *Label3;
TMenuItem *mnuPay;
TMenuItem *mnuGetMed;
void __fastcall mnuExitClick(TObject *Sender);
void __fastcall Label1Click(TObject *Sender);
void __fastcall mnuMedInfoClick(TObject *Sender);
void __fastcall mnuFeeInfoClick(TObject *Sender);
void __fastcall mnuRegClick(TObject *Sender);
void __fastcall mnuCalClick(TObject *Sender);
void __fastcall mnuPayClick(TObject *Sender);
void __fastcall mnuGetMedClick(TObject *Sender);
void __fastcall mnuQueryRegClick(TObject *Sender);
void __fastcall mnuMedStockClick(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
private:
public:
AnsiString m_szUserCode;
AnsiString m_szUserName;
__fastcall TfmMain(TComponent* Owner);
// 判断子窗体是否存在
TForm* FormExist(AnsiString szCaption);
};
extern PACKAGE TfmMain *fmMain;
#endif
//---------------------------------------
his.cpp
#include <vcl.h>
#pragma hdrstop
USEFORM( "Main.cpp ", fmMain);
USEFORM( "login.cpp ",fmLogin);
USEFORM( "Parent.cpp ", fmParent);
USEFORM( "db.cpp ", DataModule1); /* TDataModule: File Type */
USEFORM( "medinfo.cpp ", fmMedInfo);
USEFORM( "feeinfo.cpp ", fmFeeInfo);
USEFORM( "Reg.cpp ", fmReg);
USEFORM( "CalFee.cpp ", fmCalFee);
USEFORM( "pay.cpp ", fmPay);
USEFORM( "Paymoney.cpp ", fmPayMoney);
USEFORM( "getmed.cpp ", fmGetMed);
USEFORM( "ghquery.cpp ", fmQueryGH);
USEFORM( "QueryStock.cpp ", fmQuerySTK);
//---------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application-> Initialize();
Application-> Title = "医院门诊信息系统 ";
Application-> CreateForm(__classid(TDataModule1), &DataModule1);
Application-> CreateForm(__classid(TfmMain), &fmMain);
Application-> Run();
}
catch (Exception &exception)
{
Application-> ShowException(&exception);
}
return 0;
}
//---------------------------------------
[解决办法]
//USEFORM( "Main.cpp ", fmMain);
删掉,然后重新编译。
如果提示少fmMain,在少的.h窗体里
#include <login.h>
[解决办法]
Application-> CreateForm(__classid(TfmMain), &fmMain);
有这句的.h文件里添加TfmMain的引用就可以了
[解决办法]
#include <TfmMain.h> 我不知道是不是TfmMain.h,你自己看看正确不再加