This question already has an answer here:
I've got code like that:
int main()
{
char input_string[MAX_LENGTH];
char output_string[MAX_LENGTH];
cin.getline(input_string, 80, '\n');
asm
(
"lea eax, input_string\n""mov esi, eax\n""lea eax, output_string\n""mov edi, eax\n"
// SOME CODE
And I get errors:
/usr/bin/ld: /tmp/ccuMmjjG.o: in function `main':
lr4_comments.cpp:(.text+0x110): undefined reference to `input_string'
/usr/bin/ld: lr4_comments.cpp:(.text+0x118): undefined reference to `output_string'
collect2: error: ld returned 1 exit status
I compile with:
g++ -masm=intel -m32 -o main main.cpp
What's the way to do it right in Intel syntax? P.S. adding '.intel_syntax;' do nothing, only adds extra errors.