| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 784 人关注过本帖
标题:问个问题为什么我在delphi7.0中编译错误
只看楼主 加入收藏
kkllchun
Rank: 2
等 级:论坛游民
帖 子:55
专家分:13
注 册:2007-9-15
结帖率:70%
收藏
已结贴  问题点数:12 回复次数:2 
问个问题为什么我在delphi7.0中编译错误
unit csmain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,csst;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
   begin
   csstart;
   end;
end.


//下面是一个单元
unit csst;
interface
uses
 Dialogs;

implementation
procedure csstart;
begin
showmessage('测试成功');
end;
end.


//编译不通过奇怪了! 我是测试把其中的一块拿出来写个单元,这样更清晰些,但是测试的时候不通过啊.
  我觉得我的代码没有问题,因该是编译器的问题
  哪位大哥能指点下这个问题,这样我就少走好多弯路了.
搜索更多相关主题的帖子: 编译 
2010-11-28 00:24
yeye55
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:66
专家分:152
注 册:2007-1-19
收藏
得分:12 
电脑就是女朋友,她绝对没有错,有错只能是你错。编译器也是一样。

//下面是一个单元
unit csst;
interface
uses
Dialogs;

procedure csstart;

implementation
procedure csstart;
begin
showmessage('测试成功');
end;
end.

一个单元中的函数如果要在其它单元中调用,这个函数必需在implementation之前进行声明。这样其它单元才可以“看见”这个函数。如果不声明,表示这个函数是本单元私有的。

这个问题属于基本语法结构,建议找本书系统学习。

我的百度空间→http://hi.baidu.com/yeye55
2010-11-28 14:36
kkllchun
Rank: 2
等 级:论坛游民
帖 子:55
专家分:13
注 册:2007-9-15
收藏
得分:0 
虽然已经自己解决了,但还是谢谢!谢谢这位大哥的帮助!
2010-11-28 17:09
快速回复:问个问题为什么我在delphi7.0中编译错误
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015189 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved