NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: Aram on August 09, 2015, 03:09:47 AM

Title: Problem linking with link.exe on Windows
Post by: Aram 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 (http://i.imgur.com/5vYUTwC.png).
I've googled to no avail : (. I wouldnt be bothering here otherwise. Thanks in advance for your help.
Title: Re: Problem linking with link.exe on Windows
Post by: Frank Kotler 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

Title: Re: Problem linking with link.exe on Windows
Post by: Aram 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!

(http://i.imgur.com/4vK4peR.png)
Title: Re: Problem linking with link.exe on Windows
Post by: Frank Kotler 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

Title: Re: Problem linking with link.exe on Windows
Post by: johnchris845 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 (http://www.lawteam.com) 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 (http://i.imgur.com/5vYUTwC.png).
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.