I am in a college class where I am learning assembly, and I have spent half the semester fighting with Visual Studio to allow me to write and successfully build a program. Lately, I have been getting an error that I have not seen anywhere else on the internet.
Here is my setup process:
1). Create a new C++ project
2). Right-click on the project name in the Solution Explorer and set the build dependencies to MASM (.targets, .props)
3). Right-click the project name and Add New...
4). Add a Blank C++ file, changing the file extension to .asm instead of .cpp
5). Make sure I am running the code in x86 mode
6). Write the code
7). Build, but consistently get errors
Here is the code that I have been attempting to use. It moves 5 to EAX, then adds 6 to it.
.386
.model flat, stdcall
.stack 4096
exitprocess proto, dwexitcode: Dword
.data
.code
main proc
mov eax, 5
add eax, 6
invoke exitprocess, 0
main endp
end main
When I build the project, it returns this error:
Build started...
1>------ Build started: Project: Project7, Configuration: Debug Win32 ------
1>Assembling SumAndPrintArray.asm...
1>SumAndPrintArray.obj : error LNK2019: unresolved external symbol _exitprocess@4 referenced in function _main@0
1>C:\Users\richm\source\repos\Project7\Debug\Project7.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "Project7.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 10:39 PM and took 00.746 seconds ==========
No matter the project, it always returns the LNK2019 Error. I can't seem to make heads nor tails of it. I have even run a brand-new project on another computer and got the same result. What's going on?