Mail Archives: djgpp/1998/06/25/18:36:59
Bob Berkawitz wrote:
>
> I can't get this code to work. I compile it with this command:
> gcc file.c -o file.exe
> I get this error:
> file.c:6: invalid 'asm': operand number missing after %-letter
>
> Here is the code.
> void main()
> {
> asm("movl $0, %ecx"
> :/*no input*/
> :/*no output*/
> :"%ecx");
> }
>
> Line six is the line that says:
> :"%ecx");
> Thanks in advance
Remove the `%' sign in the clobber list; it's not needed there. (Only
the assembler needs it, and the assembler never sees the clobber list.)
You may also need to double the `%' in the actual asm statement, since
GCC uses that for operand constraints normally.
And, `main' should return `int'.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -