-run with import gives OPTLINK Error 42

MikeWh cf725b-0 at yahoo.com
Sat May 16 15:40:47 PDT 2009


I have 2 files: 1. a main file called caller.d, 2. a file to import called 
sub.d.  They are:

// caller.d
import sub;
import std.stdio;
void main(){
    sub mySub= new sub;
    writefln( mySub.one() );
    }

// sub.d
class sub{
    int one(){
        return 1;
        }
     }

Everything compiles fine using "dmd caller.d sub.d", and correctly writes 
"1" when I execute "caller".
But if I try "dmd -run caller.d sub.d" I get "OPTLINK Error 42: Symbol 
Undefined _D3sub3sub7_ClassZ"
I get the error even if I first do "dmd -lib sub.d".  Same thing happens in 
D 1.043 as D 2.028.

Anyone know what I'm doing wrong here? 




More information about the Digitalmars-d-learn mailing list