I am using NASM on Windows, and was following a tutorial.
maxofthree.asm:
global _maxofthree
section .text
_maxofthree:
mov eax, [esp+4]
mov ecx, [esp+8]
mov edx, [esp+12]
cmp eax, ecx
cmovl eax, ecx
cmp eax, edx
cmovl eax, edx
ret
#include <stdio.h>
int maxofthree(int, int, int);
int main() {
printf("%d\n", maxofthree(1, -4, -7));
return 0;
}
Then i type in:
nasm -f win64 maxofthree.asm
And it works, but when I do:
gcc callmaxofthree.c maxofthree.obj -o test.exe
It hits me with the good old undefined reference, like this:
ccsGyLZS.o:callmaxofthree:(.text+0x1e): undefined reference to `maxofthree'
collect2.exe: error: ld returned 1 exit status
What I have tried:
I don't know what to try I want to start with Assembly program but it's not going very well.