[疑难] 怎么在dfl中调用自己写的类,比如panel?

rocex 2009-09-14
用Entice画了一个form和panel,然后想在form中调用panel,可是总是不能通过编译。高手们给看看。

myform.d
/*
Generated by Entice Designer
Entice Designer written by Christopher E. Miller
www.dprogramming.com/entice.php
*/
module myform;

import dfl.all;

import mypanel;

class MyForm: dfl.form.Form
{
    // Do not modify or move this block of variables.
    //~Entice Designer variables begin here.
    MyPanel panel1;
    //~Entice Designer variables end here.    
    
    this()
    {
        initializeMyForm();        
        //@  Other MyForm initialization code here.        
    }
        
    private void initializeMyForm()
    {
        // Do not manually modify this function.
        //~Entice Designer 0.8.5.02 code begins here.
        //~DFL Form
        text = "My Form";
        clientSize = dfl.all.Size(292, 270);
        //~DFL dfl.panel.Panel=panel1
        panel1 = new MyPanel();
        panel1.name = "panel1";
        panel1.bounds = dfl.all.Rect(120, 128, 32, 32);
        panel1.parent = this;
        //~Entice Designer 0.8.5.02 code ends here.
    }
}

int main()
{
    int result = 0;
    
    try
    {
        Application.enableVisualStyles();
        
        //@  Other application initialization code here.
        
        Application.run(new MyForm());
    }
    catch(Object o)
    {
        msgBox(o.toString(), "Fatal Error", MsgBoxButtons.OK, MsgBoxIcon.ERROR);
        
        result = 1;
    }
    
    return result;
}


mypanel.d
/*
Generated by Entice Designer
Entice Designer written by Christopher E. Miller
www.dprogramming.com/entice.php
*/

module mypanel;

import dfl.all;

class MyPanel: dfl.panel.Panel
{
    // Do not modify or move this block of variables.
    //~Entice Designer variables begin here.
    dfl.button.Button button1;
    //~Entice Designer variables end here.    
    
    this()
    {
        initializeMyPanel();        
        //@  Other MyPanel initialization code here.        
    }
        
    private void initializeMyPanel()
    {
        // Do not manually modify this function.
        //~Entice Designer 0.8.5.02 code begins here.
        //~DFL Panel
        name = "MyPanel";
        bounds = dfl.all.Rect(0, 0, 248, 168);
        //~DFL dfl.button.Button=button1
        button1 = new dfl.button.Button();
        button1.name = "button1";
        button1.bounds = dfl.all.Rect(112, 72, 75, 23);
        button1.parent = this;
        //~Entice Designer 0.8.5.02 code ends here.
    }
}


报错如下
dfl -gui myform.d
Error checking versions; use switch -ver for details
Compiling in debug mode for testing; use -release to compile in release mode
E:\Server\Tango\bin\dmd.exe myform.d -version=DFL_EXE -debug -L/exet:nt/su:windows:4.0 E:\Server\Tango\lib\DFL_DE~1.LIB
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
myform.obj(myform)
Error 42: Symbol Undefined _D7mypanel7MyPanel7__ClassZ
myform.obj(myform)
Error 42: Symbol Undefined _D7mypanel7MyPanel5_ctorMFZC7mypanel7MyPanel
--- errorlevel 2

Returned status code 2
rocex 2009-09-14
发完帖子以后自己又试了一下,发现编译命令必须这样写:

dfl -gui myform.d mypanel.d

可是不是已经在myform.d中import了mypanel了吗?怎么还有这样编译呢?是不是dfl没有解析import?好像bud会解析import,但是不能通过编译。
smallping79 2009-09-14
dfl 就是DMD的简单改进 不是和bud什么的一样?所以要编译时要全部链接下
hqs7636 2009-09-15
如果用Eclipse,设置“编译项目”就不用那么麻烦
hqs7636 2009-09-26
我也遇到了同样的问题,也报的一样的错,原来 Eclipse 里设置“编译项目”也不好用。。。

别人怎么解决的?
Global site tag (gtag.js) - Google Analytics