Author Topic: cant complete assemble .. 'ld' command  (Read 13240 times)

Offline xdcx

  • Jr. Member
  • *
  • Posts: 12
cant complete assemble .. 'ld' command
« 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)

Offline xdcx

  • Jr. Member
  • *
  • Posts: 12
Re: cant complete assemble .. 'ld' command
« Reply #1 on: November 25, 2012, 03:26:28 AM »
k im using mingw32, is this the only way?

Offline xdcx

  • Jr. Member
  • *
  • Posts: 12
Re: cant complete assemble .. 'ld' command
« Reply #2 on: November 25, 2012, 03:38:10 AM »
now getting: Undefined Reference To 'printf'

using same source code on site

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: cant complete assemble .. 'ld' command
« Reply #3 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


Offline xdcx

  • Jr. Member
  • *
  • Posts: 12
Re: cant complete assemble .. 'ld' command
« Reply #4 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

Offline Gunner

  • Jr. Member
  • *
  • Posts: 74
  • Country: us
    • Gunners Software
Re: cant complete assemble .. 'ld' command
« Reply #5 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.