D - Module Woes
- Deja Augustine (36/36) Apr 08 2004 I'm having a problem.
- Stephan Wienczny (9/24) Apr 08 2004 You _don't_ compile the mtest module!
- Deja Augustine (2/26) Apr 08 2004 D'OH!! Thanks ;)
- C. Sauls (7/50) Apr 08 2004 Hey don't feel bad, I came to D after a few years of working almost
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
Apr 08 2004
when I compile it, I get this in the console: D:\dmd\test>..\bin\dmd add.dYour 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
Apr 08 2004
In article <c548k4$2534$1 digitaldaemon.com>, Stephan Wienczny says...D'OH!! Thanks ;)when I compile it, I get this in the console: D:\dmd\test>..\bin\dmd add.dYour 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
Apr 08 2004
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...D'OH!! Thanks ;)when I compile it, I get this in the console: D:\dmd\test>..\bin\dmd add.dYour 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
Apr 08 2004