FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Make question from a noob

 
Post new topic   Reply to topic     Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
tgore



Joined: 01 Aug 2006
Posts: 4

PostPosted: Wed Aug 02, 2006 12:04 am    Post subject: Make question from a noob Reply with quote

I have a make question w/ D.
I do simple:

import std.stdio;
int main()
{
writefln("hello, world");
return 0;
}

and build.bat:

del hello.exe hello.map
make

and Makefile:
hello.exe:
dmd hello.d -c
link hello.obj D:\dLang\dmd\lib\phobos.lib D:\dLang\dmd\lib\WS2_32.LIB +
D:\dLang\dm\lib\user32.lib D:\dLang\dm\lib\kernel32.lib D:\dLang\dm\lib\snn.lib +
D:\dLang\dm\lib\shell32.lib

but it gives mea huge error file:
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved

D:\dLang\dmd\lib\phobos.lib(ti_delegate) Offset 73562H Record Type 0091
Error 1: Previous Definition Different : __init_10TypeInfo_D
D:\dLang\dmd\lib\phobos.lib(ti_delegate) Offset 7357CH Record Type 0091
Error 1: Previous Definition Different : __Class_10TypeInfo_D
D:\dLang\dmd\lib\phobos.lib(ti_delegate) Offset 73595H Record Type 0091
Error 1: Previous Definition Different : __vtbl_10TypeInfo_D
D:\dLang\dmd\lib\phobos.lib(ti_creal) Offset 73AA8H Record Type 0091
Error 1: Previous Definition Different : __init_10TypeInfo_c
D:\dLang\dmd\lib\phobos.lib(ti_creal) Offset 73AC2H Record Type 0091
Error 1: Previous Definition Different : __Class_10TypeInfo_c
D:\dLang\dmd\lib\phobos.lib(ti_creal) Offset 73ADBH Record Type 0091
Error 1: Previous Definition Different : __vtbl_10TypeInfo_c
D:\dLang\dmd\lib\phobos.lib(ti_idouble) Offset 757DBH Record Type 0091
Error 1: Previous Definition Different : __init_10TypeInfo_p
D:\dLang\dmd\lib\phobos.lib(ti_idouble) Offset 757F5H Record Type 0091
Error 1: Previous Definition Different : __Class_10TypeInfo_p
D:\dLang\dmd\lib\phobos.lib(ti_idouble) Offset 7580EH Record Type 0091
Error 1: Previous Definition Different : __vtbl_10TypeInfo_p
D:\dLang\dmd\lib\phobos.lib(ti_Acreal) Offset 7BCDFH Record Type 0091
Error 1: Previous Definition Different : __init_11TypeInfo_Ac
D:\dLang\dmd\lib\phobos.lib(ti_Acreal) Offset 7BCFAH Record Type 0091
Error 1: Previous Definition Different : __Class_11TypeInfo_Ac
D:\dLang\dmd\lib\phobos.lib(ti_Acreal) Offset 7BD14H Record Type 0091
Error 1: Previous Definition Different : __vtbl_11TypeInfo_Ac
D:\dLang\dmd\lib\WS2_32.LIB Offset 01A95H Record Type 0088
Error 1: Previous Definition Different : _htonl@4
D:\dLang\dmd\lib\WS2_32.LIB Offset 01AC5H Record Type 0088
Error 1: Previous Definition Different : _htons@4
D:\dLang\dmd\lib\WS2_32.LIB Offset 01BB5H Record Type 0088
Error 1: Previous Definition Different : _ntohl@4
D:\dLang\dmd\lib\WS2_32.LIB Offset 01BE5H Record Type 0088
Error 1: Previous Definition Different : _ntohs@4
phobos.lib
Warning 2: File Not Found phobos.lib
D:\dLang\dmd\lib\phobos.lib(com)
Error 42: Symbol Undefined _IID_IUnknown
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegQueryValueExA@24
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegCloseKey@4
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegQueryInfoKeyA@48
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegCreateKeyExA@36
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegOpenKeyExA@20
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegOpenKeyA@12
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegDeleteKeyA@8
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegSetValueExA@24
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegDeleteValueA@8
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegFlushKey@4
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegEnumKeyExA@32
D:\dLang\dmd\lib\phobos.lib(registry)
Error 42: Symbol Undefined _RegEnumValueA@32
--- errorlevel 29
D:\dLang\proj>

If I do a dmd hello.d it works.
I will need to be able to make Makefiles so that I can add gui libraries and other non D libraries. I looked on the web for tutorials on make....
Can somone help a noob?

Tom
Back to top
View user's profile Send private message
Derek Parnell



Joined: 22 Apr 2004
Posts: 408
Location: Melbourne, Australia

PostPosted: Wed Aug 02, 2006 12:51 am    Post subject: Re: Make question from a noob Reply with quote

tgore wrote:
I have a make question w/ D.
I do simple:

import std.stdio;
int main()
{
writefln("hello, world");
return 0;
}

and build.bat:

del hello.exe hello.map
make

and Makefile:
hello.exe:
dmd hello.d -c
link hello.obj D:\dLang\dmd\lib\phobos.lib D:\dLang\dmd\lib\WS2_32.LIB +
D:\dLang\dm\lib\user32.lib D:\dLang\dm\lib\kernel32.lib D:\dLang\dm\lib\snn.lib +
D:\dLang\dm\lib\shell32.lib

but it gives mea huge error file: ...
Tom


I wrote a tool that may be able to help you with this. It is called 'Build' and can be found at

http://trac.dsource.org/projects/build/

It simplifies the process of building an application using D. In your case with the example above you just type in ...

Code:

build hello


Build is smart enough to see what files are need to be compiled and/or linked and creates the needed command lines to do the job. It then runs the commands too, of course. This works no matter how many import files you have at any depth. Check out the documentation that comes with it as there are many options you can use to cater for nearly all situations that you used to rely on make for.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
tgore



Joined: 01 Aug 2006
Posts: 4

PostPosted: Wed Aug 02, 2006 12:56 pm    Post subject: Reply with quote

Thanks derek, but I need to have a working make file, so that it works on mac, etc. (and so that I start learning make).

So, still, can somone help me w/ comiling a hello world? (and then I will add wxWidgets for D)

Tom
Back to top
View user's profile Send private message
Derek Parnell



Joined: 22 Apr 2004
Posts: 408
Location: Melbourne, Australia

PostPosted: Wed Aug 02, 2006 5:14 pm    Post subject: Reply with quote

tgore wrote:
Thanks derek, but I need to have a working make file, so that it works on mac, etc. (and so that I start learning make).

So, still, can somone help me w/ comiling a hello world? (and then I will add wxWidgets for D)

Tom


I'm getting Build to work with Mac, but its your call.

The problem you are experiencing is a problem with OptLink, the linker used by DMD in Windows. It gets the location of the libraries from the LIB environment symbol. The DMD compiler sets this manually from information recorded in the sc.ini file. Build also does this. For you to get make to do it, you will need to have a line that goes like ...
Code:

set LIB=C:\dmd\lib;c:\dm\lib


On the other hand, why bother with make. You must like working harder than you need to. Wink
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
tgore



Joined: 01 Aug 2006
Posts: 4

PostPosted: Wed Aug 02, 2006 7:57 pm    Post subject: Reply with quote

OK w/ that Set I have less errors:
Error1: Previous Definition is Different.

??

more help please. (and I do need the make since I will be mixing c, libs, etc.)

Seperatley, I tried to make wxd and it told me:
can't read makefile build/msw/config.dmc \
?

Tom
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed Aug 02, 2006 8:09 pm    Post subject: Reply with quote

Try:
Code:
link hello.obj WS2_32.LIB user32.lib kernel32.lib shell32.lib

And if that doesn't work, consider adding "snn.lib" back to the list. phobos.lib is linked automatically so you don't want to manually specify it, and I suspect snn.lib is as well. Also, there's no need to specify the path the libs are in if that directory is in the LIB path list. You might also want to look at the makefiles I use for Ares as examples:

http://svn.dsource.org/projects/ares/trunk/src/ares/win32.mak
http://svn.dsource.org/projects/ares/trunk/src/ares/linux.mak
Back to top
View user's profile Send private message
Derek Parnell



Joined: 22 Apr 2004
Posts: 408
Location: Melbourne, Australia

PostPosted: Wed Aug 02, 2006 10:18 pm    Post subject: Reply with quote

tgore wrote:
OK w/ that Set I have less errors:
Error1: Previous Definition is Different.

??

more help please. (and I do need the make since I will be mixing c, libs, etc.)


Ok, but Build handles those too.

Anyhow, seeing that you are linking Windows stuff, you need to add the windows libraries that you need to the linker list.

You might want to consider ...
Code:

gdi32.lib
advapi32.lib
COMCTL32.LIB
comdlg32.lib
CTL3D32.LIB
kernel32.lib
ODBC32.LIB
ole32.lib
OLEAUT32.LIB
shell32.lib
user32.lib
uuid.lib
winmm.lib
winspool.lib
wsock32.lib

_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
tgore



Joined: 01 Aug 2006
Posts: 4

PostPosted: Thu Aug 03, 2006 1:37 pm    Post subject: Reply with quote

Thanks for the help so far. No luck, but I do have luck w/ gdc and MinGW.

Question on build.exe you are making:

Can it build wxd.lib? (from http://wxd.sourceforge.net - for win and mac) ?

Tom
Back to top
View user's profile Send private message
nwawudu



Joined: 10 Mar 2008
Posts: 1

PostPosted: Fri Apr 18, 2008 5:17 am    Post subject: Reply with quote

Quote:
dmd hello.d -c
link hello.obj D:\dLang\dmd\lib\phobos.lib D:\dLang\dmd\lib\WS2_32.LIB +
D:\dLang\dm\lib\user32.lib D:\dLang\dm\lib\kernel32.lib D:\dLang\dm\lib\snn.lib +
D:\dLang\dm\lib\shell32.lib

but it gives mea huge error file:
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved

D:\dLang\dmd\lib\phobos.lib(ti_delegate) Offset 73562H Record Type 0091
Error 1: Previous Definition Different : __init_10TypeInfo_D


I had a similar problem when DMD is installed to D: drive ( i.e not C: ).

It looks like a known issue with sc.ini, see http://d.puremagic.com/issues/show_bug.cgi?id=459 for more info.

To fix it edit both dm\bin\sc.ini and dmd\bin\sc.ini as follows.

LIB="%@P%\..\lib";\dm\lib
- to -
LIB="%@P%\..\lib;%@P%\..\..\dm\lib"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group