Here is my question that I can't manage to google and solve. I wrote a simple C++ program that adds two numbers. However, how do I call an assembly code to do this addition. It will be easier to show what I have so here it is.
Here is my file called Adding.cpp
//============================================================================
// Name : Adding.cpp
// Author : Casey
// Version : Eclipse Galileo
// Copyright :
// Description :
//============================================================================
#include <iostream>
using namespace std;
int main() {
int x;
extern int sum(int a1, a2);
cout << "Enter Numbers\n";
cin >> a1, a2;
x = sum(a1, a2);
cout << x << endl;
return 0;
Now here is my assembly language code in a different file called Add.s
//
//Add.s
//Created on: Sep 14, 2011
//Author: Casey
Sum:
pushl %ebp,
movl %ebp, %esp
movl 8(%ebp), %eax
movl 12(%ebp), %ecx
addl %eax, %ecx
pop %ebp
ret
I have multiple errors on the lines 'extern' and 'cin' and I'm not 100% sure I wrote the code correctly. How do I put these two together?