| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
April 08, 2004 Module Woes | ||||
|---|---|---|---|---|
| ||||
I'm having a problem.
I have the following files:
========mtest.d===========
module mtest;
int c;
static this()
{
c = 3;
}
int add(int x, int y)
{
return x + y;
}
void compile(char[] pattern, char[] attributes)
{
}
===========add.d============
import mtest;
int main()
{
int a = add(1, 2);
return 0;
}
when I compile it, I get this in the console:
D:\dmd\test>..\bin\dmd add.d
D:\dmd\bin\..\..\dm\bin\link.exe add,,,user32+kernel32/noi;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
add.obj(add)
Error 42: Symbol Undefined _D5mtest3addFiiZi
--- errorlevel 1
it doesn't matter what symbols I'm using, it always comes up as Error 42: Symbol Undefined if it's from a module.
Does anyone have any insights?
Thanks
-Deja
| ||||
April 08, 2004 Re: Module Woes | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Deja Augustine | > when I compile it, I get this in the console: > D:\dmd\test>..\bin\dmd add.d Your problem is here ^^^^^^^ > D:\dmd\bin\..\..\dm\bin\link.exe add,,,user32+kernel32/noi; or here ^^^^ > OPTLINK (R) for Win32 Release 7.50B1 > Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved > > add.obj(add) > Error 42: Symbol Undefined _D5mtest3addFiiZi > --- errorlevel 1 > > it doesn't matter what symbols I'm using, it always comes up as Error 42: Symbol > Undefined if it's from a module. > > Does anyone have any insights? > You _don't_ compile the mtest module! If you want to compile your project just run "dmd add.d mtest.d" The mtest module is only virtually imported. Unlike in C or C++ includes the compiler does not compile code in imported modules. You have to compile and link imported modules, too. Stephan | |||
April 08, 2004 Re: Module Woes | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Stephan Wienczny | In article <c548k4$2534$1@digitaldaemon.com>, Stephan Wienczny says... > > >> when I compile it, I get this in the console: D:\dmd\test>..\bin\dmd add.d > >Your problem is here ^^^^^^^ > >> D:\dmd\bin\..\..\dm\bin\link.exe add,,,user32+kernel32/noi; > >or here ^^^^ > >> OPTLINK (R) for Win32 Release 7.50B1 >> Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved >> >> add.obj(add) >> Error 42: Symbol Undefined _D5mtest3addFiiZi >> --- errorlevel 1 >> >> it doesn't matter what symbols I'm using, it always comes up as Error 42: Symbol Undefined if it's from a module. >> >> Does anyone have any insights? >> > >You _don't_ compile the mtest module! >If you want to compile your project just run > >"dmd add.d mtest.d" > >The mtest module is only virtually imported. Unlike in C or C++ includes the compiler does not compile code in imported modules. You have to compile and link imported modules, too. > >Stephan D'OH!! Thanks ;) | |||
April 09, 2004 Re: Module Woes | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Deja Augustine | Hey don't feel bad, I came to D after a few years of working almost
entirely with Java... I /still/ forget this sometimes. One of the
reasons I started using a build utility... its hard to mess up a
commandline that I don't even have to type. :)
-C. Sauls
-Invironz
Deja Augustine wrote:
> In article <c548k4$2534$1@digitaldaemon.com>, Stephan Wienczny says...
>
>>
>>>when I compile it, I get this in the console:
>>>D:\dmd\test>..\bin\dmd add.d
>>
>>Your problem is here ^^^^^^^
>>
>>
>>>D:\dmd\bin\..\..\dm\bin\link.exe add,,,user32+kernel32/noi;
>>
>>or here ^^^^
>>
>>
>>>OPTLINK (R) for Win32 Release 7.50B1
>>>Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
>>>
>>>add.obj(add)
>>>Error 42: Symbol Undefined _D5mtest3addFiiZi
>>>--- errorlevel 1
>>>
>>>it doesn't matter what symbols I'm using, it always comes up as Error 42: Symbol
>>>Undefined if it's from a module.
>>>
>>>Does anyone have any insights?
>>>
>>
>>You _don't_ compile the mtest module!
>>If you want to compile your project just run
>>
>>"dmd add.d mtest.d"
>>
>>The mtest module is only virtually imported. Unlike in C or C++ includes the compiler does not compile code in imported modules. You have to compile and link imported modules, too.
>>
>>Stephan
>
>
>
> D'OH!! Thanks ;)
>
>
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply