?在unit1里调unit2的,就要先把unit2的head file给include进来原码

cyg1dm 2001-06-08 12:33:00
表单1
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
Unit2->ShowModal();
}
//---------------------------------------------------------------------------
表单2

#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm2::FormCreate(TObject *Sender)
{

}
//---------------------------------------------------------------------------
出现错误:
[C++ Error] Unit1.cpp(21): E2451 Undefined symbol 'Unit2'
...全文
58 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sephil 2001-06-13
  • 打赏
  • 举报
回复
和尚对!
wjzhuang 2001-06-08
  • 打赏
  • 举报
回复
和尚,rh你们还在呀~~~~~~~~~
可惜我要下了,不然可以聊聊~~~~~
rh 2001-06-08
  • 打赏
  • 举报
回复
哈哈~~给和尚分~~
xycleo 2001-06-08
  • 打赏
  • 举报
回复
Unit2->ShowModal();
这里错了!!

是Form2->ShowModal();

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧