Assembly Programs Not Compiling in x86 Build Visual Studio - visual-studio

so I'm trying to learn MASM, and I've looked online but I can't get it to compile in an x86 Build. I have a simple .asm file that just has
end
then a c file with main.
When I set VS with a x64 Build it compiles successfully with ml64; however, when I use x86 I get:
1>C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\masm.targets(50,5):
error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\test.obj"
/W3 /errorReport:prompt /Tatest.asm" exited with code 1.

Related

Visual Studio 2022: error MSB3721: The command "ml.exe ... " exited with code 1

I am using Microsoft Visual Studio Community 2022 (ARM 64-bit) Version 17.3.0 Preview 6.0 to build a Win32 (Intel x86 32-bit) application. I get the following error:
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VC\v170\BuildCustomizations\masm.targets(70,5): error MSB3721: The command "ml.exe /c /nologo /Sg /Zi /Fo"Debug\byteasm.obj" /D"_DEBUG" /Fl"Debug\byteasm.lst" /W3 /errorReport:prompt /TaC:\Users\James\Documents\Dolphin\Core\DolphinVM\VMLib..\byteasm.asm" exited with code 1.
But when I open a command prompt I can successfully execute the following:
"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.33.31629\bin\Hostx86\x86\ml.exe" /c /nologo /Sg /Zi /Fo"Debug\byteasm.obj" /D"_DEBUG" /Fl"Debug\byteasm.lst" /W3 /errorReport:prompt /TaC:\Users\James\Documents\Dolphin\Core\DolphinVM\VMLib..\byteasm.asm
Assembling: C:\Users\James\Documents\Dolphin\Core\DolphinVM\VMLib..\byteasm.asm
Since I can execute the same thing (?) from the command line I don't understand why VisualStudio is reporting an error. Any advice? Once I've done the assembly manually, can I tell VisualStudio to skip it?
The suggestion from #njuffa to increase the verbosity of the build was helpful and showed the error that it could not find ml.exe. I believe this is a bug in Version 17.3.0 Preview 6.0 since it is able to find the C++ compiler for x86. My workaround was to add the x86 tools directory to the path (which would break attempts to build for any other environment). Thanks to all for the helpful responses and advice!

msbuild with vcpkg uses different triplet from Visual Studio for x86, but works for x64

I have a library project for both x64 and x86. Within Visual Studio I can build both x64 and x86. When I use msbuild, the x64 builds with the correct triplet but the Win32 builds with x86-windows not the expected x86-windows-static. The vcproj file has the right triplets, as you can see from the snippet.
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
Here is the example for the successful x64
VERBOSE: msbuild.exe C:\code\proj53\proj53.vcxproj /nologo /p:Configuration=Release
/t:Clean,Rebuild /p:DebugSymbols=false /p:platform=x64
VcpkgTripletSelection:
Using triplet "x64-windows-static" from "C:\code\vcpkg\installed\x64-windows-static\"
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\CL.exe
/c /Iinclude /I"C:\code\vcpkg\installed\x64-windows-static\include" /Zi /nologo ...
And here is the example for the failing x86. I don't understand why it is selecting x86-windows and not the x86-windows-static as given in the vxcproj.
VERBOSE: msbuild.exe C:\code\proj53\proj53.vcxproj /nologo /p:Configuration=Release
/t:Clean,Rebuild /p:DebugSymbols=false /p:platform=x86
VcpkgTripletSelection:
Using triplet "x86-windows" from "C:\code\vcpkg\installed\x86-windows\"
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\CL.exe
/c /Iinclude /I"C:\code\vcpkg\installed\x86-windows\include" /Zi /nologo ...
fatal error C1083: Cannot open include file: 'curl/curl.h'
fatal error C1083: Cannot open include file: 'tinyxml2.h'
Can anyone point me in the right direction?

Can not build assembly code in visual studio

For some reason, I have to use some assembly code in my dll library project. My visual studio version is 2019.
I follow the settings as below to build assembly code
Project -> Build customizations, check masm
In the property of my assembly code file, set Item Type to Microsoft Macro Assembler
Then I build the project and got the following error.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\masm.targets(70,5): error MSB3721: The command "ml64.exe /c /nologo /Zi /Fo"x64\Debug\my_assembly.obj" /W3 /errorReport:prompt /Tamy_assembly.asm" exited with code 1.
But if I go to my project directory and run ml64.exe with options in error message above, I can successfully build the assembly code.
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64\ml64.exe" /c /nologo /Zi /Fo"x64\Debug\my_assembly.obj" /W3 /errorReport:prompt /Tamy_assembly.asm
Assembling: my_assembly.asm
After the manual build of my_assembly.obj from commandline, the build also succeed in visual studio IDE.
What's wrong with the ml64.exe invoked from visual studio IDE?

Build failed with error MSB3721 when building a CUDA SDK example under Visual Studio 2010

I am working on CUDA with Visual Studio 2010. I installed the CUDA toolkit and SDK but one of the SDK examples is not building successfully.
The output console shows:
1>_CUDA_Build_Rule:
1> Compiling with CUDA Build Rule...
1> The system cannot find the path specified.
1>E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\Cuda.targets(45,5): error MSB3721: The command "echo "$(CUDA_BIN_PATH)\nvcc.exe" -arch sm_10 -ccbin "E:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /Od /Zi /MTd " -I"E:\CUDA\include;../../common/inc" -maxrregcount=32 --compile -o "$(IntDir)\$(InputName).cu.obj" "E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\bandwidthTest\bandwidthTest.cu"
1>E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\Cuda.targets(45,5): error MSB3721: "$(CUDA_BIN_PATH)\nvcc.exe" -arch sm_10 -ccbin "E:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /Od /Zi /MTd " -I"E:\CUDA\include;../../common/inc" -maxrregcount=32 --compile -o "$(IntDir)\$(InputName).cu.obj" "E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\bandwidthTest\bandwidthTest.cu"" exited with code 1.
1>
1>Build FAILED.
there is some problem with the nvcc.exe
When i execute nvcc.exe in command prompt, it shows :
nvcc fatal: No input file specified
I'm afraid yours is a non-programming question.
Anyway, if you run nvcc from the command line, you obviously get that error message because you are not specifying which file do you like to compile.
Below, I'm pointing out some other threads with the same problem you detailed. I hope they could be useful to you:
Visual Studio 2010 - how to fix Error MSB3721 - exiting with code 1
CUDA Visual Studio 2010 Express build error
Fixing Visual Studio Express error when cleaning 64-bit projects using CUDA 4.1 nvcc compiler

Set up x64 in Visual C++ 2010

I am trying to learn x64 assembly using Visual Studion 2010.
I was following this video tutorial : x64 Assembly and C++ Tutorial 1: Getting into x64 ASM from C++
As it says, I installed Visual Studio 2010, windows 7 SDK 3.5 (ISO install) and edited the configuration.
But when I compile the code, I get following error :
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets(49,5): error MSB3721: The command "ml64.exe /c /nologo /Zi /Fo"x64\Debug\asm.obj" /W3 /errorReport:prompt /Taasm.asm" exited with code 1.
What is this problem, and how can I solve it?
Look at the assembler output above that line, or build the .asm file by itself.
You should see warnings generated by the assembler
eg. "somefile.asm(564): warning A6004: procedure argument or local not referenced :"
Deal with those warnings. The "exited with code 1" is not very explanatory.

Resources