0

Here's my code:

#include <stdio.h>

int main(void) {
    printf("Hello! \n");
    return 0;
}

I call first cl /Fa test.c, then call ml test.asm and I get the errors:

LIBCMT.lib(default_local_stdio_options.obj) : error LNK2005: ___local_stdio_printf_options already defined in test.obj libvcruntime.lib(undname.obj) : error LNK2005: ___local_stdio_printf_options already defined in test.obj test.exe : fatal error LNK1169: one or more multiply defined symbols found

It works fine if I don't use printf. What am I doing wrong?

vimuth
  • 5,064
  • 33
  • 79
  • 116
slimdusty
  • 11
  • 3
  • From https://stackoverflow.com/questions/60201854/symbols-already-defined-error-when-compiling-assembly-output-from-visual-studio Peter Cordes says MSVC doesn't produce asm you can use, is that the issue? Seems a bit odd it works without the call to printf? – slimdusty Jul 14 '22 at 05:03
  • Oh am I supposed to be using ml test.obj? That seems to be working after using cl /Fa /c test.c. Sorry I really have no idea what I'm doing and there seems to be no documentation. – slimdusty Jul 14 '22 at 05:28

0 Answers0