P
Protoman
I'm having the trouble getting the inline assembler and/or linker of
Dev-Cpp to see my variable that's been passed into the C++ fn where the
inline ASM code is. Can anyone help me figure out how to get this to
work? The specific error is "[Linker error] undefined reference to
`val'". And here's my program:
#include <iostream>
#include <cstdlib>
using std::cout;
using std::cin;
using std::endl;
using std::system;
int Double(int val)
{
asm("mov eax,val \n");
asm("add eax,eax \n");
asm("mov val,eax \n");
return val;
}
int main()
{
int val;
cout << "Enter a value: " << endl;
cin >> val;
cout << val << "*2=" << Double(val) << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
If anyone could help, that'd be great. Thanks!!!!
Dev-Cpp to see my variable that's been passed into the C++ fn where the
inline ASM code is. Can anyone help me figure out how to get this to
work? The specific error is "[Linker error] undefined reference to
`val'". And here's my program:
#include <iostream>
#include <cstdlib>
using std::cout;
using std::cin;
using std::endl;
using std::system;
int Double(int val)
{
asm("mov eax,val \n");
asm("add eax,eax \n");
asm("mov val,eax \n");
return val;
}
int main()
{
int val;
cout << "Enter a value: " << endl;
cin >> val;
cout << val << "*2=" << Double(val) << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
If anyone could help, that'd be great. Thanks!!!!