www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Error 42: Symbol Undefined

reply jicman <jicman_member pathlink.com> writes:
Ok, so I have been using build and I have been working perfectly fine, until
today, when I want to use DDoc and tried using

dmd -I.. -D test.d

I get,

11:50:42.85>dmd -I.. test.d
.\jic\libs\MyLibTest.d(3): no identifier for declarator PrintHello
.\jic\libs\MyLibTest.d(3): semicolon expected, not '{'
.\jic\libs\MyLibTest.d(3): Declaration expected, not '{'
.\jic\libs\MyLibTest.d(5): unrecognized declaration

11:55:02.08>dmd -I.. test.d
c:\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

test.obj(test)
Error 42: Symbol Undefined _D3jic4libs9MyLibTest10PrintHelloFZAa
--- errorlevel 1

source code is simple,

11:55:28.87>type test.d

private import jic.libs.MyLibTest;
int main(char[][] args)
{
PrintHello();
return 1;
}

and

11:58:08.13>type ..\jic\libs\MyLibTest.d
module jic.libs.MyLibTest;
char[] PrintHello()
{
printf("Hello\n");
}

I tried to see what options I could use, but somehow, the -I option for dmd is
not finding ..\jic\libs\.

Any ideas?

thanks.

josé
May 11 2006
next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"jicman" <jicman_member pathlink.com> wrote in message 
news:e3vn8q$1nnb$1 digitaldaemon.com...
 11:58:08.13>type ..\jic\libs\MyLibTest.d
 module jic.libs.MyLibTest;
 char[] PrintHello()
 {
 printf("Hello\n");
 }
Well, you're not linking this file in anywhere, as far as I can see. You'll have to put either its source file or its object file on the command line.
May 11 2006
parent reply jicman <jicman_member pathlink.com> writes:
Jarrett Billingsley says...
"jicman" <jicman_member pathlink.com> wrote in message 
news:e3vn8q$1nnb$1 digitaldaemon.com...
 11:58:08.13>type ..\jic\libs\MyLibTest.d
 module jic.libs.MyLibTest;
 char[] PrintHello()
 {
 printf("Hello\n");
 }
Well, you're not linking this file in anywhere, as far as I can see. You'll have to put either its source file or its object file on the command line.
You mean that I have to do, dmd -D -I.. test.d ..\jic\libs\MyLibTest.d Is this correct? So, if I have 10 library files (..\jic\libs\MyLibTest0-9.d) I have to add them all to the command? I.e. dmd -D -I.. test.d ..\jic\libs\MyLibTest0.d ..\jic\libs\MyLibTest1.d .\jic\libs\MyLibTest2.d ..\jic\libs\MyLibTest3.d ..\jic\libs\MyLibTest4.d .\jic\libs\MyLibTest5.d ..\jic\libs\MyLibTes6.d ..\jic\libs\MyLibTest7.d .\jic\libs\MyLibTest8.d ..\jic\libs\MyLibTest9.d If so, what does the -I option does then? Sorry to be so unwise at this, but build does all of that for me. :-) And I have been using build since the Good Lord brought me to D. thanks for the help
May 11 2006
next sibling parent James Pelcis <jpelcis gmail.com> writes:
If you use -I, you don't actually tell the compiler to import anything. 
  All you do is give it another directory from which it should look for 
imports.

For example, you can use -I"C:\verylongannoyingpathofevil\derelict\" so 
that you don't need to write it out for ever derelict module you use.

btw, I think Derek would love to hear that statement.  He's worked hard 
to make it easier to use D.

jicman wrote:
 If so, what does the -I option does then?  Sorry to be so unwise at this, but
 build does all of that for me. :-)
May 11 2006
prev sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"jicman" <jicman_member pathlink.com> wrote in message 
news:e40agm$2l8q$1 digitaldaemon.com...
 You mean that I have to do,

 dmd -D -I.. test.d ..\jic\libs\MyLibTest.d

 Is this correct?  So, if I have 10 library files 
 (..\jic\libs\MyLibTest0-9.d) I
 have to add them all to the command?  I.e.

 dmd -D -I.. test.d ..\jic\libs\MyLibTest0.d ..\jic\libs\MyLibTest1.d
 .\jic\libs\MyLibTest2.d ..\jic\libs\MyLibTest3.d ..\jic\libs\MyLibTest4.d
 .\jic\libs\MyLibTest5.d ..\jic\libs\MyLibTes6.d ..\jic\libs\MyLibTest7.d
 .\jic\libs\MyLibTest8.d ..\jic\libs\MyLibTest9.d
Or, just do this: dmd -D -I"..\jib\libs\" test.d MyLibTest.d MyLibTest0.d MyLibTest1.d ... Or, if you've already compiled those libs to .obj files, dmd -D -I"..\jib\libs\" test.d MyLibTest.obj MyLibTest0.obj ...
May 12 2006
prev sibling parent Derek Parnell <derek psych.ward> writes:
On Thu, 11 May 2006 16:03:38 +0000 (UTC), jicman wrote:

 Ok, so I have been using build and I have been working perfectly fine, until
 today, when I want to use DDoc and tried using
 
 dmd -I.. -D test.d
All this does is compile the file 'test.d', it does not compile nor link your library module. Try this instead ... dmd -I.. test.d ..\jic\libs\MyLibTest.d The dmd compiler is quite brain-dead when it comes to finding files. You have to tell it everything. Another way is to create a 'response file' for dmd. ---------- test.rsp --------- -I.. test.d ..\jic\libs\MyLibTest.d ----------------------------- Then use ... dmd test.rsp Alternatively, just use 'Build' ;-) -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 12/05/2006 9:45:27 AM
May 11 2006