Author Topic: Problem linking with link.exe on Windows  (Read 16607 times)

Offline Aram

  • Jr. Member
  • *
  • Posts: 2
Problem linking with link.exe on Windows
« on: August 09, 2015, 03:09:47 AM »
Hi guys, I'm trying to set up NASM in windows, using nasm as assembler and visual studio's linker as linker, but I'm having problems with the latter. Trying to link the code against the static C library in the first example from here
http://web.archive.org/web/20120414223112/http://www.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

I get the following error .
I've googled to no avail : (. I wouldnt be bothering here otherwise. Thanks in advance for your help.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Problem linking with link.exe on Windows
« Reply #1 on: August 09, 2015, 08:22:20 AM »
There is a remote chance that telling your linker "/subsystem:console"  might help - maybe even "/subsystem:console,5.01". "/verbose:lib" might also produce some noise. The most common cause of this error seems to be leaving off the underscore, but you didn't do that. Good luck!

Best,
Frank


Offline Aram

  • Jr. Member
  • *
  • Posts: 2
Re: Problem linking with link.exe on Windows
« Reply #2 on: August 09, 2015, 09:12:21 AM »
There is a remote chance that telling your linker "/subsystem:console"  might help - maybe even "/subsystem:console,5.01". "/verbose:lib" might also produce some noise. The most common cause of this error seems to be leaving off the underscore, but you didn't do that. Good luck!

Best,
Frank

I feel really dumb  :-[ but apparently the problem comes from using the linker version 14.0.., using the version that comes with VS2013 (12.0..) I'm linking correctly, thanks!


Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Problem linking with link.exe on Windows
« Reply #3 on: August 09, 2015, 10:05:16 AM »
Don't feel dumb. That's really useful information! I wonder if there's some "trick" we can use to beat an executable out of version 14.0 or if "use version 12.0" is the only answer? I'll leave it up to you Windows guys to figure it out - it was this kind of thing that drove me away from them in the first place! Thanks for the solution!

Best,
Frank


Offline johnchris845

  • New Member
  • Posts: 1
Re: Problem linking with link.exe on Windows
« Reply #4 on: April 25, 2016, 12:05:58 PM »
Hi guys, I'm trying to set up NASM in windows, using nasm as assembler and visual studio's linker as linker, but I'm having problems with the latter. Trying to link the code against the static C library in the first example from here
http://web.archive.org/web/20120414223112/http://www.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

I get the following error .
I've googled to no avail : (. I wouldnt be bothering here otherwise. Thanks in advance for your help.

But my concern is security. If links.exe is located in a subfolder of the user's profile folder, the security rating is 32% dangerous.