[疑难] D离实用还有很大距离?!

sw2wolf 2007-10-16
以下都使用Digital Mars D Compiler v1.015

1.下载了dwt-win32-0.36-20060421.rar并解压到e:\dwt

c:\dwt\import>make-dwt-lib.bat
......
E:\rnd\DWT\import>build -release -O -clean -inline  -lib -full -allobj dwt\all.d -T..\lib\dwt.lib -version=OLE_COM -version=DRAG_DROP
dwt\ole\win32\oleclientsite.d(576): no identifier for declarator int
dwt\ole\win32\oleclientsite.d(576): semicolon expected, not 'ref'
dwt\ole\win32\oleclientsite.d(576): found 'ref' instead of statement
dwt\ole\win32\oleclientsite.d(577): expression expected, not 'ref'
dwt\ole\win32\oleclientsite.d(579): expression expected, not 'ref'
dwt\ole\win32\oleframe.d(227): no identifier for declarator int
dwt\ole\win32\oleframe.d(227): semicolon expected, not 'ref'
dwt\ole\win32\oleframe.d(227): found 'ref' instead of statement
dwt\ole\win32\oleframe.d(228): expression expected, not 'ref'
dwt\ole\win32\oleframe.d(232): expression expected, not 'ref'
dwt\ole\win32\oleeventsink.d(106): no identifier for declarator int
dwt\ole\win32\oleeventsink.d(106): semicolon expected, not 'ref'
dwt\ole\win32\oleeventsink.d(106): found 'ref' instead of statement
dwt\ole\win32\oleeventsink.d(107): expression expected, not 'ref'
dwt\ole\win32\oleeventsink.d(109): expression expected, not 'ref'
......
编译失败, 没生成lib文件.

2.下载了gtkD-pre5.zip并解压到e:\GtkD
e:\GtkD\compdGtkD.bat
成功生成gtkd.lib, 好高兴

e:\GtkD\compdGtkDTests.bat

E:\rnd\GtkD>compd demos/gtkD -o GtkDTests -I src -I demos -c -L .+\dmd\lib\+phobos+gtkd+advapi32

demos\gtkD\TestDrawingArea.d(351):
function gdk.Pixbuf.Pixbuf.renderToDrawable
(Drawable,GdkGC *,int,int,int,int,int,int,GdkRgbDither,int,int) does not match parameter types
(GdkDrawable *,GdkGC *,int,int,int,int,int,int,GdkRgbDither,int,int)

demos\gtkD\TestDrawingArea.d(351): Error: cannot implicitly convert expression ((d.getDrawableStruct)()) of type GdkDrawable * to gdk.Drawable.Drawable

......

dmd demos\gtkD\TEditableCells.d demos\gtkD\TestAspectFrame.d demos\gtkD\TestDrawingArea.d demos\gtkD\TestEntries.d demos\gtkD\TestIdle.d demos\gtkD\TestImage.d demos\gtkD\TestScales.d demos\gtkD\TestStock.d demos\gtkD\TestText.d demos\gtkD\TestThemes.d demos\gtkD\TestTreeView.d demos\gtkD\TestTreeView1.d demos\gtkD\TestWindow.d demos\gtkD\TTextView.d   -odobj  -op  -Isrc;demos   -c  -I\dmd\src\phobos

ExecutorSync.execute=
dmd demos\gtkD\TEditableCells.d demos\gtkD\TestAspectFrame.d demos\gtkD\TestDrawingArea.d demos\gtkD\TestEntries.d demos\gtkD\TestIdle.d demos\gtkD\TestImage.d demos\gtkD\TestScales.d demos\gtkD\TestStock.d demos\gtkD\TestText.d demos\gtkD\TestThemes.d demos\gtkD\TestTreeView.d demos\gtkD\TestTreeView1.d demos\gtkD\TestWindow.d demos\gtkD\TTextView.d   -odobj  -op  -Isrc;demos   -c  -I\dmd\src\phobos

Exec.compile status = 1
失败!

换个简单的hello.d试试(将gtkd.lib移到\dm\lib)

import gtk.MainWindow;
import gtk.Label;
import gtk.GtkD;

void main(char[][] args)
{
GtkD.init(args);
MainWindow win = new MainWindow("Hello World");
win.setDefaultSize(200, 100);
win.add(new Label("Hello World"));
win.showAll();

GtkD.main();
}

e:\GtkD\dmd hello.d -Isrc

e:\dm\bin\link.exe hello,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
hello.obj(hello)
Error 42: Symbol Undefined _D3gtk4GtkD4GtkD4initFAAaZv
hello.obj(hello)
Error 42: Symbol Undefined _D3gtk10MainWindow10MainWindow7__ClassZ
hello.obj(hello)
Error 42: Symbol Undefined _D3gtk10MainWindow10MainWindow5_ctorMFAaZC3gtk10Main
Window10MainWindow
hello.obj(hello)
Error 42: Symbol Undefined _D3gtk5Label5Label7__ClassZ
hello.obj(hello)
Error 42: Symbol Undefined _D3gtk5Label5Label5_ctorMFAabZC3gtk5Label5Label
hello.obj(hello)
Error 42: Symbol Undefined _D3gtk4GtkD4GtkD4mainFZv
--- errorlevel 6

但是这此Symbol在gtkd.lib里
e:\GtkD\lib -l gtkd.lib > gtkd.lst
e:\GtkD\grep _D3gtk4GtkD4GtkD4initFAAaZv gtkd.lst

_D3gtk4GtkD4GtkD4initFAAaZv      GtkD
_D3gtk4GtkD4GtkD4initFAAaZv       _D3gtk4GtkD4GtkD20getCurrentEventState
FPE4gtkc8gdktypes15GdkModifierTypeZi

晕了, 请高手指导下, 谢谢!
sw2wolf 2007-10-16
加上gtkd.lib
e:\GtkD\dmd hello.d -Isrc gtkd.lib

e:\dmd\bin\..\..\dm\bin\link.exe hello,,,gtkd.lib+user32+kernel32/noi;

OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
e:\dm\bin\..\lib\gtkd.lib(GtkD)
Error 42: Symbol Undefined _gtk_init
e:\dm\bin\..\lib\gtkd.lib(GtkD)
Error 42: Symbol Undefined _gtk_main
e:\dm\bin\..\lib\gtkd.lib(GtkD)
Error 42: Symbol Undefined _gtk_main_quit
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_text
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_attributes
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_markup
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_markup_with_mnemonic
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_pattern
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_justify
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_ellipsize
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_width_chars
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_max_width_chars
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_parse_uline
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_line_wrap
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_line_wrap_mode
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_layout_offsets
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_mnemonic_keyval
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_selectable
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_text
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_select_region
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_mnemonic_widget
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_selectable
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_set_text_with_mnemonic
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_attributes
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_justify
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_ellipsize
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_width_chars
e:\dm\bin\..\lib\gtkd.lib(Label)
Error 42: Symbol Undefined _gtk_label_get_max_width_chars

......
oldrev 2007-10-16
1)建议您看一下DWT的 SVN Log:
http://www.dsource.org/projects/dwt/browser
trunk 105 1 year Shawn Liu: make DWT compliant with DMD 0.154

2)仍然建议您看一下 gtkD 的 readme
http://www.dsource.org/projects/dui/browser/trunk/gtkD/README
10 Requirements:
11 -------------
12 - linux or windows(2000, XP)
13 - Gtk libs
14 - dmd installation
15   (on your home directory on linux or the root directory on windows)
16 optionally:
17 - openGL libs (mesa is fine on linux)
18 - gtkglext
19 - compd(dool) http://svn.dsource.org/projects/dool/trunk
tomqyp 2007-10-16
DWT和gtkD都已经好久不更新了,DWT主页上有一个网友为D1.0打过补丁的非官方版本,不过还是要做些修改才能成功的在现在的DMD中编译出来。

另外,先不管GUI库的编译错误跟语言成熟与否有没有关系,许多论坛都不赞成用激将法来吸引人答贴,而且在这里大家都是比较愿意相互帮助的。
hohoyeh 2007-10-16
我的倒是成功了,但是编译出来的程序说是什么非合法WINDOWS APPLCATION,郁闷的说。。


C:\dmd\DWT\import>make-dwt-lib
deleting old intermediate files ...

C:\dmd\DWT\import>del *.obj *.map *.rsp *.lsp *.ksp *.def /s /q
Could Not Find C:\dmd\DWT\import\*.obj
Build release version ...

C:\dmd\DWT\import>build -release -O -clean -inline  -lib -full -allobj dwt\all.d
-T..\lib\dwt.lib -version=OLE_COM -version=DRAG_DROP
Digital Mars Librarian Version 8.02n
Copyright (C) Digital Mars 2000-2007 All Rights Reserved
http://www.digitalmars.com/ctg/lib.html
Digital Mars Librarian complete.
-----------------------------------------
Build debug version ...

C:\dmd\DWT\import>build -debug -g -unittest -clean  -lib -full -allobj dwt\all.d
-T..\lib\dwtd.lib  -version=OLE_COM -version=DRAG_DROP
Digital Mars Librarian Version 8.02n
Copyright (C) Digital Mars 2000-2007 All Rights Reserved
http://www.digitalmars.com/ctg/lib.html
Digital Mars Librarian complete.
-----------------------------------------
you may need to copy "dwt.lib" "dwtd.lib" to \dmd\lib

C:\dmd\DWT\import>pause
Press any key to continue . . .
sw2wolf 2007-10-17
下载了dwt_dmd1.patch.zip, 并修改了总份源码后编译成功, 生成了dwt.lib与dwtd.lib. 然后修改\dmd\bin\sc.ini
[Version]
version=7.51 Build 020

[Environment]
LIB="%@P%\..\lib";\dm\lib;\dwt\lib
DFLAGS="-I%@P%\..\src\phobos;\dwt\import"
LINKCMD=%@P%\..\..\dm\bin\link.exe

cd \dwt\packages\dwt\examples\controlexample
1. run-build.bat
生成的exe为非法的WINDOWS程序

2. run-dmd.bat
成功 !

看来build有点问题
redsea 2007-10-17
是不是现在是建议使用rebuild 而不是 build ?
Global site tag (gtag.js) - Google Analytics