0

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?

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
  • 1
    its called ExitProcess – pm100 Mar 20 '23 at 03:54
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Ken White Mar 20 '23 at 04:11
  • Create another project, write the code in C or C++, set the options for the compiler to generate assembly code in order to see the actual names needed for assembler source code. Note that C++ "mangles" names, if this is a C++ project. – rcgldr Mar 20 '23 at 08:22
  • 2
    Just to clarify pm100's comment: Function names are case sensitive. It's `ExitProcess`, not `exitprocess`. – David Wohlferd Mar 20 '23 at 09:08
  • Yep, that was it. My teacher repeatedly would say that assembly is not case sensitive....I guess thats not always the case. Thanks for your help!! – TheRichinator Mar 21 '23 at 17:34

0 Answers0