In the Visual C ++ project, add the. ASM file as required by MASM. In Solution Explorer, right-click the file and select the "properties" menu item. In the "properties" dialog box, click "Custom generation step" to set the following items:
Command Line: ml.exe/nologo/C/coff "-fo $ (intdir)/$ (inputname). OBJ" "$ (inputpath )"
Output: $ (intdir)/$ (inputname). OBJ
To generate debugging information, you can add the "/Zi" parameter to the command line, and generate. lst and. SBR files as needed.
If you want to call Windows API in an assembly file, you can download the masm32 package from the Internet (including the MASM Assembly Tool, a very complete Windows API header file/library file, a practical macro, and a large number of Win32 Assembly examples ). Correspondingly, the "/I X:/masm32/include" parameter should be added to the command line to specify the path of the Windows API Assembly header file (. Inc. Masm32 home page is: http://www.masm32.com, which can download the latest version of the masm32 package.