www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Error 42:

reply Mikael Haapakoski <mikael.haapakoski gmail.com> writes:
I'm trying to move my simple header from C to D and try to use that 
function in D. Functio is like sin but if draw my rin it isn't curve. it 
is straight angle. I'm using windows and rin.d (old rin.h is located 
under phobos direcrory.

====================================================================
ERROR MESSAGE:
parse     rini
semantic  rini
semantic2 rini
semantic3 rini
code      rini
generating code for function 'main'
C:\dc\dmd\bin\..\..\dm\bin\link.exe rini,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

rini.obj(rini)
  Error 42: Symbol Undefined _D3rin3rinFfZf

--- errorlevel 1
======================================================
======================================================
RINI.D (what i'm compiling):
import omat.rin;

float i;

int main()
{

	i = rin(2);
	printf("\n%f", i);
	return 0;
}
======================================================
======================================================
RIN.D (where the function is):
//like sin

float rin(float x)
{

       float xx;

       if(x>10){

                do{x=x-10;

                }while(x>10);}

       if(x<-10){

                do{x=x+10;

                }while(x<-10);}


       if( x < 0 ) { xx = ( x + 10 ); }
       if( x > 0 ) { xx = (-1*x+10 );}

       if( x == 0 ){ xx = 10;}
       if( x == -10 || x == 10 ){ xx = -10; }

       xx = xx * 0.1;
       return xx;
       }
Apr 15 2005
next sibling parent reply Jeremy Cowgar <jeremy __no_spam__.cowgar.cooooom> writes:
Mikael Haapakoski wrote:
 I'm trying to move my simple header from C to D and try to use that 
 function in D. Functio is like sin but if draw my rin it isn't curve. it 
 is straight angle. I'm using windows and rin.d (old rin.h is located 
 under phobos direcrory.
Try doing something like: dmd main.d omat/rin.d (or omat/rin.d = wherever your rin.d file is) Jeremy
Apr 15 2005
parent reply jicman <jicman_member pathlink.com> writes:
Or use,

build main.d

:-)


Jeremy Cowgar says...
Mikael Haapakoski wrote:
 I'm trying to move my simple header from C to D and try to use that 
 function in D. Functio is like sin but if draw my rin it isn't curve. it 
 is straight angle. I'm using windows and rin.d (old rin.h is located 
 under phobos direcrory.
Try doing something like: dmd main.d omat/rin.d (or omat/rin.d = wherever your rin.d file is) Jeremy
Apr 15 2005
next sibling parent reply Mikael Haapakoski <mikael.haapakoski gmail.com> writes:
now i changed 1 line of rini.d (module file) as module omat.rin and 
executed command "dmd rini.d" because i don't have main.d at all. Still 
i got same error message.

Then i tried this kind of solution. I copied omat directory with rin.d 
to same directory where rini.d is located. then i remobed i line so it 
isn't module anymore. i changet 1 line of rini.d (what you called as 
main.d) to "#include <c:\dc\omat\omat\rin.d>". My rini (main) is located 
at c:\dc\omat\. After all this i ran again "dmd rini.d" (main). Now i 
got a bit differend error message. It goes like this:
rini.d(1): #line integer ["filespec"]\n expected
rini.d(1): Declaration expected, not '<'
rini.d(1): undefined escape sequence \d

rini.d(1): undefined escape sequence \o




jicman kirjoitti:
 Or use,
 
 build main.d
 
 :-)
 
 
 Jeremy Cowgar says...
 
Mikael Haapakoski wrote:

I'm trying to move my simple header from C to D and try to use that 
function in D. Functio is like sin but if draw my rin it isn't curve. it 
is straight angle. I'm using windows and rin.d (old rin.h is located 
under phobos direcrory.
Try doing something like: dmd main.d omat/rin.d (or omat/rin.d = wherever your rin.d file is) Jeremy
Apr 15 2005
next sibling parent Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
1. There's no '#include' in D
2. You can get the 'build' utility from here: 
http://dsource.org/projects/build/
3. Without 'build', you have to pass all of your files to dmd, so "dmd 
rini.d" won't do. You might try "dmd rini.d omat\rin.d" (or whatever 
paths you have there)
4. Notepad's not the best editor... Actually it's one of the worst when 
it comes to programming. Check this out: 
http://www.wikiservice.at/d/wiki.cgi?EditorSupport
/* my current favourite is the Elephant IDE */
5. Excellent resource: http://dsource.org/tutorials/


-- 
Tomasz Stachowiak  /+ a.k.a. h3r3tic +/
Apr 15 2005
prev sibling parent Mikael Haapakoski <mikael.haapakoski gmail.com> writes:
After readin about lib files things are comin more clearer to me.

Mikael Haapakoski kirjoitti:
 now i changed 1 line of rini.d (module file) as module omat.rin and 
 executed command "dmd rini.d" because i don't have main.d at all. Still 
 i got same error message.
 
 Then i tried this kind of solution. I copied omat directory with rin.d 
 to same directory where rini.d is located. then i remobed i line so it 
 isn't module anymore. i changet 1 line of rini.d (what you called as 
 main.d) to "#include <c:\dc\omat\omat\rin.d>". My rini (main) is located 
 at c:\dc\omat\. After all this i ran again "dmd rini.d" (main). Now i 
 got a bit differend error message. It goes like this:
 rini.d(1): #line integer ["filespec"]\n expected
 rini.d(1): Declaration expected, not '<'
 rini.d(1): undefined escape sequence \d
 
 rini.d(1): undefined escape sequence \o
 
 
 
 
 jicman kirjoitti:
 
 Or use,

 build main.d

 :-)


 Jeremy Cowgar says...

 Mikael Haapakoski wrote:

 I'm trying to move my simple header from C to D and try to use that 
 function in D. Functio is like sin but if draw my rin it isn't 
 curve. it is straight angle. I'm using windows and rin.d (old rin.h 
 is located under phobos direcrory.
Try doing something like: dmd main.d omat/rin.d (or omat/rin.d = wherever your rin.d file is) Jeremy
Apr 15 2005
prev sibling parent reply Mikael Haapakoski <mikael.haapakoski gmail.com> writes:
and another thing. i don't have build command. like i said iäm using 
windows and notepad as editor. could it be that notepad puts that kind 
of end to file what d compiler doesn't understand?

jicman kirjoitti:
 Or use,
 
 build main.d
 
 :-)
 
 
 Jeremy Cowgar says...
 
Mikael Haapakoski wrote:

I'm trying to move my simple header from C to D and try to use that 
function in D. Functio is like sin but if draw my rin it isn't curve. it 
is straight angle. I'm using windows and rin.d (old rin.h is located 
under phobos direcrory.
Try doing something like: dmd main.d omat/rin.d (or omat/rin.d = wherever your rin.d file is) Jeremy
Apr 15 2005
next sibling parent Mikael Haapakoski <mikael.haapakoski gmail.com> writes:
Though iot compiles my self made main files correctly. this is my forst 
module or header what iäm trying to do for D

Mikael Haapakoski kirjoitti:
 and another thing. i don't have build command. like i said iäm using 
 windows and notepad as editor. could it be that notepad puts that kind 
 of end to file what d compiler doesn't understand?
 
 jicman kirjoitti:
 
 Or use,

 build main.d

 :-)


 Jeremy Cowgar says...

 Mikael Haapakoski wrote:

 I'm trying to move my simple header from C to D and try to use that 
 function in D. Functio is like sin but if draw my rin it isn't 
 curve. it is straight angle. I'm using windows and rin.d (old rin.h 
 is located under phobos direcrory.
Try doing something like: dmd main.d omat/rin.d (or omat/rin.d = wherever your rin.d file is) Jeremy
Apr 15 2005
prev sibling parent Chris Sauls <ibisbasenji gmail.com> writes:
Mikael Haapakoski wrote:
 and another thing. i don't have build command. like i said iäm using 
 windows and notepad as editor. could it be that notepad puts that kind 
 of end to file what d compiler doesn't understand?
You can get the very useful Build utility here: http://dsource.org/projects/build/ And you might double-check that Notepad isn't putting a .txt on the ends of your filenames. Generally its better to find a coding editor, such as EditPlus or ConTEXT, rather than stick with Notepad. (Although for many moons I did all my HTML, PHP, Java, and C code in Notepad... but I don't dare say I'd want to go back.) -- Chris Sauls
Apr 16 2005
prev sibling parent J C Calvarese <jcc7 cox.net> writes:
Mikael Haapakoski wrote:
 I'm trying to move my simple header from C to D and try to use that 
 function in D. Functio is like sin but if draw my rin it isn't curve. it 
 is straight angle. I'm using windows and rin.d (old rin.h is located 
 under phobos direcrory.
 
 ====================================================================
 ERROR MESSAGE:
 parse     rini
 semantic  rini
 semantic2 rini
 semantic3 rini
 code      rini
 generating code for function 'main'
 C:\dc\dmd\bin\..\..\dm\bin\link.exe rini,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
You may have already gotten this to work, but in case someone else runs into a problem like this I thought I'd explain a fix. I've set up three files (which are attached): rin.d, rini.d, and rin.bat. All three are put into a folder called "omat". Run "rin.bat" to compile and run the program. I moved some punctuation around, but the only significant change that I made to your files was adding "module omat.rin;" to the top of rin.d. (By the way, this error message is also described at http://www.prowiki.org/wiki4d/wiki.cgi?ErrorMessages#Error42SymbolUndefined.) This is what is looks like when I run "rin.bat": ---------------------------------------------------------------- I:\pgm\d\examples\linker_error_msg\omat>dmd rini.d rin.d -I.. d:\dmd\bin\..\..\dm\bin\link.exe rini+rin,,,user32+kernel32/noi; I:\pgm\d\examples\linker_error_msg\omat>rini.exe 0.800000 I:\pgm\d\examples\linker_error_msg\omat>pause Press any key to continue . . . -- jcc7 http://jcc_7.tripod.com/d/
Apr 16 2005