Results 1 to 7 of 7

Thread: im stuck getting werid error msg,

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    3

    im stuck getting werid error msg,

    im getting this error msg.. dunno wat to do...

    Linking...
    LINK : error LNK2001: unresolved external symbol _mainCRTStartup
    C:\Documents and Settings\Racer\Desktop\temp\hw1.1\Debug\hw1.1.exe : fatal error LNK1120: 1 unresolved externals
    hw1.1 - 2 error(s), 0 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    Im suppose to do a inverse of x into y, then sum all the number in y, and put result into z, if anyone know my 2 errors, that be great too, thanks

    Code:
    include irvine32.inc
    
    .data
    X   SDWORD    -3000, -2000, -1000, 0, 1000, 2000, 3000
    Y   SDWORD   7 DUP (?) 
    Z   SDWORD   ?
    
    .code
    begin:
    lea eax,x
    lea ebx,y
    lea edx,z
    mov ecx,7
    
    next:
    
    ;pushing x into a stack
    push [eax]
    add eax,4
    
    ;pop the stack and store to y
    pop [ebx]
    add ebx,4
    loop next
    
    
    mov ecx,7
    ;sum all
    
    next1:
    add ebx,4
    loop next1
    
    ;stores into z
    mov edx,ebx
    
    
    end

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: im stuck getting werid error msg,

    Your linker wants to link against the C runtime startup function. You need to do something else, depending on what it is you want.
    1) If you're writing just a single function in ASM, you need to avoid calling the linker. Pass the assemble-only flag to MASM or something.
    2) If your assembly is a complete program that does not use the CRT, you need to set the entry point to your own. I see no such code here, though.
    3) If your assembly is a complete program that uses the CRT (even just having a main() function counts), you need to link against the CRT.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Member
    Join Date
    Oct 2006
    Posts
    53

    Re: im stuck getting werid error msg,

    If you include "irvine32.inc" i would say that "irvine32.lib" is missing. This will generate such messages.
    Code:
    include irvine32.inc
    includelib irvine32.lib

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    3

    Re: im stuck getting werid error msg,

    yea, that is solve but another problem pop up . i build it and went fine. when i went to debug it, it say... any ideas??

    'hw1.1.exe': Loaded 'C:\Documents and Settings\Racer\Desktop\temp\hw1.1\debug\hw1.1.exe', Symbols loaded.
    'hw1.1.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
    'hw1.1.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
    The program '[2276] hw1.1.exe: Native' has exited with code 0 (0x0).

    ahh why can't my first assembly program go well .

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: im stuck getting werid error msg,

    It starts and ends with a success code. Looks like your entry function is empty.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6
    Member
    Join Date
    Oct 2006
    Posts
    53

    Re: im stuck getting werid error msg,

    You have not shown all code so it is difficult to say. I suppose "begin:" is the entrypoint which mean the code ends with "End begin".

    You also have API ExitProcess with argument 0
    Code:
    push 0
    call ExitProcess
    There you have the message "has exited with code 0 (0x0)."

    It seems to be OK. To debug with debugging information you must assemble and link your code with debug options.

    I can't see the problem.

  7. #7
    Member
    Join Date
    Oct 2006
    Posts
    53

    Re: im stuck getting werid error msg,

    I don't know what you do with irvine32.dll but if you want to se the result of your calculation you can do it like this.
    Code:
    .586
    .model flat,stdcall
    option casemap:none
    
    include user32.inc
    include kernel32.inc
    
    includelib user32.lib
    includelib kernel32.lib
    
    .data
    x   SDWORD    -3000, -2000, -1000, 0, 1000, 2000, 3000
    y   SDWORD   7 DUP (?) 
    z   SDWORD   ?
    szFormat	db "Result: %d",0
    
    .data?
    buffer		dd 128 DUP (?)
    
    .code
    begin:
    	lea eax,x
    	lea ebx,y
    	lea edx,z
    	mov ecx,7
    	
    next:
    	
    	;pushing x into a stack
    	push [eax]
    	add eax,4
    	
    	;pop the stack and store to y
    	pop [ebx]
    	add ebx,4
    	loop next
    	
    	
    	mov ecx,7	
    	;sum all
    	
    	next1:
    	add ebx,4
    	loop next1
    	
    	;stores into z
    	mov edx,ebx	
    	push z
    	lea eax,szFormat
    	push eax
    	lea eax,buffer
    	push eax
    	call wsprintf
    	add esp,0Ch
    	
    	push 0
    	push 0
    	lea eax,buffer
    	push eax
    	push 0
    	call MessageBox
    	
    	push 0
    	call ExitProcess
    	
    end begin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width