NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: xdcx on November 25, 2012, 03:09:29 AM

Title: cant complete assemble .. 'ld' command
Post by: xdcx on November 25, 2012, 03:09:29 AM
following this example:
http://cs.lmu.edu/~ray/notes/nasmexamples/

Code: [Select]
global _main
extern _printf

section .text
_main:
push message
call _printf
add esp, 4
ret
message:
db 'hello world',10,0

http://s9.postimage.org/8x3eltczx/nasm_ld.jpg
i don't have 'ld' in environment variables

(win 7:64)
Title: Re: cant complete assemble .. 'ld' command
Post by: xdcx on November 25, 2012, 03:26:28 AM
k im using mingw32, is this the only way?
Title: Re: cant complete assemble .. 'ld' command
Post by: xdcx on November 25, 2012, 03:38:10 AM
now getting: Undefined Reference To 'printf'

using same source code on site
Title: Re: cant complete assemble .. 'ld' command
Post by: Frank Kotler on November 25, 2012, 04:03:49 AM
Try adding "-lc" to the "ld" command line...

MinGW32 is not the only way to do it, but if you've gotten this far you might as well continue with it. Note that you're not doing it quite like the example you cite, but it "should" work, I think.

As an alternative, take a look at NASMX:

http://sourceforge.net/projects/nasmx/files/nasmx-1.1/Windows/

Let us know how you solve this, if you would...

Best,
Frank

Title: Re: cant complete assemble .. 'ld' command
Post by: xdcx on November 25, 2012, 04:06:47 AM
now im using link.exe from masm/VC instead of mingw (its nice though cause its like linux)

Code: [Select]
link.exe file.obj libcmt.lib
compiles fine
Title: Re: cant complete assemble .. 'ld' command
Post by: Gunner on November 25, 2012, 06:11:42 PM
You need to add the path to \MinGW\bin to your PATH environment variable in control panel, or use the full path to ld.

Or, you could just use GoLink which works great.