How do you compile assembly code using Visual Studio?
I want to compile and run an assembly source file in Visual Studio 2010.
I've created a Visual C++ project and inserted some assembly code in a file code.asm
:
.586 ;Target processor. Use instructions for Pentium class machines
.MODEL FLAT, C ;Use the flat memory model. Use C calling conventions
.STACK ;Define a stack segment of 1KB (Not required for this example)
.DATA ;Create a near data segment. Local variables are declared after
;this directive (Not required for this example)
.CODE ;Indicates the start of a code segment.
clear PROC
xor eax, eax
xor ebx, ebx
ret
clear ENDP
END
However the problem is when you try and compile this, you get:
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
I did go and enable the build customization masm.targets
(right click project > Build Customizations..), but to no avail.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…