2
我現在嘗試編譯使用gcc和代碼塊以下代碼:如何使用gcc和codeblock編譯彙編語言?
#include <stdio.h>
int main()
{
char alphabet = 'X';
printf ("Type letter = ");
asm{ //line 8
mov ah, 02
mov dl, [alphabet] // line 9
int 21h
}
printf ("\n");
return (0);
}
錯誤消息我有如下:
error: expected '(' before '{' token line 8
error: 'mov' was not declared in this scope line9
我編譯的x86計算機,並想知道我如何成功地編譯上述代碼。謝謝!
GCC對內聯彙編使用非常不同的語法。見[GCC內聯彙編操作指南](http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html)。 – DCoder
謝謝,我會看看。 – feelfree
AT&T與英特爾ASM語法: http://stackoverflow.com/questions/199966/how-do-you-use-gcc-to-generate-assembly-code-in-intel-syntax – 2012-12-26 10:18:10