how to not compile only

kryptoid256 1 Reputation point
2020-09-03T05:27:48.03+00:00

Error MSB3721 The command "ml64.exe /c /nologo /Zi /Fo"x64\Debug\Source.obj" /W3 /errorReport:prompt /TaSource.asm" exited with code 1. Project1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\BuildCustomizations\masm.targets 70
I want to get rid of the /c command
someone tell me how

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,335 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Darran Rowe 1,016 Reputation points
    2020-09-06T11:09:56.517+00:00

    One thing to note is that Visual Studio always passes the /c option. For example, the command line, according to the Visual Studio logs, for a C++ project that fully builds is:

    /c /I"X64\DEBUG\GENERATED FILES\" /ZI /nologo /W4 /WX- /diagnostics:column /sdl /Od /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /permissive- /Zc:wchar_t /Zc:forScope /Zc:inline /std:c++latest /Fo"X64\DEBUG\" /Fd"X64\DEBUG\VC142.PDB" /Gd /TP /FC /bigobj /await C:\USERS\DARRAN\SOURCE\REPOS\MEH\MEH\MAIN.CPP

    The /c works in the same way for cl.exe as for ml.exe/ml64.exe.

    The reason why the /c is passed in is because without the /c, the compiler/assembler will then take the input files, compile them and then immediately call the linker to link. Now, with a multi file project, especially one where you use different tools or command line options (for example, different preprocessor directives), it is possible that the compiler/assembler may be executed multiple times. This means that for every set of files that you compile or assemble, you have one instance of the linker running.

    Visual Studio does run a separate linker instance if the compilation is successful. For the project that I obtained the compiler command line above, the linker command line was:

    /OUT:"C:\USERS\DARRAN\SOURCE\REPOS\MEH\X64\DEBUG\MEH.EXE" /INCREMENTAL /NOLOGO KERNEL32.LIB USER32.LIB GDI32.LIB WINSPOOL.LIB COMDLG32.LIB ADVAPI32.LIB SHELL32.LIB OLE32.LIB OLEAUT32.LIB UUID.LIB ODBC32.LIB ODBCCP32.LIB WINDOWSAPP.LIB /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG:FASTLINK /PDB:"C:\USERS\DARRAN\SOURCE\REPOS\MEH\X64\DEBUG\MEH.PDB" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\USERS\DARRAN\SOURCE\REPOS\MEH\X64\DEBUG\MEH.LIB" /MACHINE:X64 X64\DEBUG\MAIN.OBJ

    So as you can see, the .obj generated from cl.exe is passed into link.exe here.

    Also, as Viorel mentioned, if I assemble a file with a syntax error, for example a missing END statememt:

    _TEXT SEGMENT  
      
    PUBLIC retnum  
      
    retnum PROC  
      
    	xor eax, eax  
    	ret  
    retnum ENDP  
      
    _TEXT ENDS  
      
    ;END  
    

    I get the output:

    1>------ Build started: Project: meh, Configuration: Debug x64 ------
    1>Assembling asm64.asm...
    1>asm64.asm(13): error A2088: END directive required at end of file
    1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Microsoft\VC\v160\BuildCustomizations\masm.targets(70,5): error MSB3721: The command "ml64.exe /c /nologo /Zi /Fo"x64\Debug\asm64.obj" /W3 /errorReport:prompt /Taasm64.asm" exited with code 1.
    1>Done building project "meh.vcxproj" -- FAILED.

    Notice that after the assembler error, there is the error that you mentioned? Basically, if you fix the error in the assembly file, this will go away.

    22834-2020-09-06-2.png

    So focus on fixing the assembler error.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.