Okay, I was wrong, that didn't fix anything. Here's my code now:
_ad.asm
Code:
;add.asm - function of main.c adds two given variables and returns answer
;Andy Gearhart
;Nov 13, 2003
_ad: push ebp
mov ebp,esp
mov eax,[ebp+8]
mov ebx,[ebp+12]
add eax,ebx
mov esp,ebp
pop ebp
ret
main.c
Code:
*
Program Name: main.c
Description: Adds 2 ints using an Assembly function
Programmer: Andy Gearhart
*/
#include <stdio.h>
int ad(int,int);
int main(int argv, char *argc[])
{
int a,b,total;
printf("Enter two integers");
scanf("%i %i", &a, &b);
total=ad(a,b);
printf("The sum of %i + %i = %i",a,b,total);
return 0;
}
Here's the error message I get:
D:\Hwk3\Task2>gcc -Wall -o main.exe main.c _ad.o
d:/djgpp/tmp\cchG8Zlv.o(.text+0x6e):main.c: undefined reference to `ad'
collect2: ld returned 1 exit status