


Why does one of these try to find printf and the other, _printf? I get that there's an underscore convention, but it doesn't seem to be understood by both linkers. Test.exe : fatal error LNK1120: 1 unresolved externals Test.obj : error LNK2001: unresolved external symbol _printf Microsoft (R) Incremental Linker Version 7.0Ĭopyright (C) Microsoft Corporation. Trying the equivalent with the visual studio linker: d:\Code\nasm>link -out:test.exe -entry:main -subsystem:console test.obj Ok, so I need to point the linker at the ucrt library: $ ld -o test.exe /c/Program\ Files\ \(x86\)/Windows\ Test.obj:test.nasm:(.text+0圆): undefined reference to `printf'

When trying to link it to the windows CRT (ucrt.lib), I get the following error: $ ld -o test.exe test.obj I have the following basic program in nasm: global _mainĪnd it builds fine using nasm -f win32 test.nasm I happen to be using a MinGW version of ld for linking, but I'm happy to use the visual studio link.exe if it makes things simpler.
