Friday, 23 August 2013

Error when trying to add two integers in C

Error when trying to add two integers in C

I'm trying to learn C and my very simple program is simply trying to add
two numbers by calling a function.
I get the following number when trying to compile and run it:
Undefined symbols for architecture x86_64:
"_print", referenced from:
_main in ccepYqVz.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Here is what my code looks like:
#include <stdio.h>
int addNumbers( int x, int y);
int main() {
int total = addNumbers(10,5);
print("Total %d", total);
return 0;
}
int addNumbers( int x, int y) {
return x+y;
}

No comments:

Post a Comment