Set up x64 in Visual C++ 2010 - visual-studio-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.

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!

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?

Assembly Programs Not Compiling in x86 Build 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.

Missing standard C libraries in cl

I have a Windows project that came with a Makefile.vc. I would like to import this into Visual Studio 10.0. My initial effort is to run nmake and invoke the cl.exe compiler.
After getting some paths straights my first run generates this message:
cl /nologo /W3 /O1 -I..\./ -I..\charset/ -I..\windows/ -I..\unix/ -I..\macosx/ /D_WINDOWS /D_WIN32_WINDOWS=0x500 /DWINVER=0x500 /DHAS_GSSAPI /DSECURITY
_WIN32 /c ..\be_all_s.c
be_all_s.c
..\be_all_s.c(6) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.EXE"' : return code '0x2'
Stop.
Now I know where the VC stdio.h header is, on my PC it's at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include. So it would be a simple matter to add a -I to the makefile and include this directory.
But durn burn it I don't think I should have to! Other build systems don't make me do this and why doesn't the command line compiler know where its standard headers are installed? So I'm asking if there's a config file, an .ini file or something else that cl reads that tells it where to look for the standard C library. I've been browsing the internet and Visual Studio help with no success.
Just after I posted the question I found the answer.
Start > All Programs > Microsoft Visual 10.0 > Microsoft Visual Studio Tools > Visual Studio Command Prompt
This gives me a command prompt with all the paths, env. variables etc. set.
Why didn't I find that earlier?

Qt 4.8.3 Windows 7 Compile Using Visual Studio Express 2012

I'm still new to Qt. In the past I used to download Qt on a computer and install it without any problems and I get immediate access to all Qt SDK resources including QtCreator.
Now, I downloaded Qt SDK 4.8.3 and after some reading I ended up installing Windows SDK 7. Then I extracted Qt files to C:\Qt. I also added C:\Qt\4.8.3\ to the system path. Then I ran configure which is concluded with no errors. Then I attempted to run nmake which failed with the following error:
Generating Code...
link /LIBPATH:"c:\Qt\4.8.3\lib" /LIBPATH:"c:\Qt\4.8.3\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /BASE:0x67000000 /DEBUG /DLL /MANIFEST /MANIFESTFILE:"tmp\obj\debug_shared\QtCored.intermediate.manifest" /VERSION:4.83 /OUT:....\lib\QtCored4.dll #C:\Users\MELKAM~1\AppData\Local\Temp\nm5A03.tmp
Creating library ....\lib\QtCored4.lib and object ....\lib\QtCored4.exp
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\Bin\amd64\link.EXE"' : return code '0x463'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\Bin\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
Now I have tried the above twice with no luck. Any pointer where should I look? any suggestions are appreciated.
Thanks.
What are you compiling with? MSVC or mingw? If the former, I have found this link incredibly helpful...
http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/
I have followed his instructions for 64bit and 32bit builds many times.
Edit: You have your qt build configured for a MSVC2010 (1600) build, so it's looking in the "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\nmake.exe" directory, which doesn't exist if you only have MSVC2012 (which is version 11.0).
Qt 4.8 doesn't officially support MSVC2012 (yet?), but if you really want to use 2012 then you can try the suggestions at this link. It's complicated, especially if this is your first source build, but seems do-able if you're willing to tinker with the Qt source code.
I had the same issue. the problem was installing visual studio 2012 on a machine with visual studio 2010.
May be this can help https://stackoverflow.com/a/15132209/1933829
Did you run configure from the 64bit tools command tool in vs?
Did you add -platform win32-msvc2010 to the configure commandline (yes even for 64bit builds you need -win32- )

Resources