### Author Topic: Unresolved External Symbol for Basic Subroutine???  (Read 591 times)

#### ColbyCoffman

• Regular Member
• Posts: 2
##### Unresolved External Symbol for Basic Subroutine???
« on: February 21, 2022, 04:32:38 AM »
Hello, first I would like to say I am new here and I am very sorry if I am posting in the wrong place but I am new to MASM and I am pulling my hair out. Here is the basic code I'm Having issues with.

.386
.model flat, stdcall
.stack 4096

sample PROTO
ExitProcess PROTO, dwExitCode:DWORD

.code
main PROC
CALL sample
INVOKE ExitProcess, 0
main ENDP
END main

sample PROC
ret
sample ENDP

Seems fine to me, except when I build it  I get a 1>Source.obj : error LNK2019: unresolved external symbol _sample@0 referenced in function _main@0. Error. I beleive this should only happen when i call a subroutine that is not properly linked from an external file, but this subroutine is in THE SAME FILE. Maybe I have configured something wrong in visual studios. Any help would be appreciated.

#### nidud

• Member
• Posts: 2388
##### Re: Unresolved External Symbol for Basic Subroutine???
« Reply #1 on: February 21, 2022, 04:41:09 AM »
deleted
« Last Edit: February 24, 2022, 09:28:15 PM by nidud »

#### ColbyCoffman

• Regular Member
• Posts: 2
##### Re: Unresolved External Symbol for Basic Subroutine???
« Reply #2 on: February 21, 2022, 04:43:39 AM »
I am facepalming myself right now. Thank you so much nidud

#### Vortex

• Member
• Posts: 2745
##### Re: Unresolved External Symbol for Basic Subroutine???
« Reply #3 on: February 21, 2022, 04:53:05 AM »
Hi Colby,

Here is another example for you :

Code: [Select]
`include \masm32\include\masm32rt.incsample  PROTO :DWORD      .datatitle1  db 'Hello',0mymsg   db 'This is a test.',0.codemain PROC    invoke  sample,ADDR mymsg        invoke  ExitProcess,0main ENDPsample  PROC message:DWORD    invoke  MessageBox,0,message,\            ADDR title1,MB_OK    retsample  ENDPEND main`