Note that there are some explanatory texts on larger screens.

plurals
  1. POQt C++ Project with non-inline assembly
    text
    copied!<p>I am using Windows XP, and Newest Qt Creator with QtSDK and the built-in gcc compiler.</p> <p>The question is, how to use full assembly in a C++ Qt Project. I know how to use inline assembly, but I don't know how to do non-inline(written in a separate .asm file) full assembly, in a Qt C++ project.</p> <p>Is this possible with a Qt C++ project, and if so, how?</p> <p>EDIT:</p> <p>*<strong>pro file</strong> </p> <pre><code>TEMPLATE = app CONFIG += console CONFIG -= qt SOURCES += \ calc.S </code></pre> <p><strong>calc.S</strong></p> <pre><code>section .data hello: db 'Hello world!', 10 helloLen: equ $-hello section .text global _start _start: mov eax, 4 mov ebx, 1 mov ecx, hello mov edx, helloLen int 80h proexit: mov eax, 1 mov ebx, 0 int 80h </code></pre> <p><strong>Compile errors</strong></p> <pre><code>..\plain_cpp\calc.S: Assembler messages: ..\plain_cpp\calc.S:1: Error: no such instruction: `section .data' ..\plain_cpp\calc.S:2: Error: no such instruction: `db 72ello world!4410' ..\plain_cpp\calc.S:3: Error: no such instruction: `equ $-hello' ..\plain_cpp\calc.S:5: Error: no such instruction: `section .text' ..\plain_cpp\calc.S:6: Error: no such instruction: `global _start' ..\plain_cpp\calc.S:9: Error: too many memory references for `mov' ..\plain_cpp\calc.S:10: Error: too many memory references for `mov' ..\plain_cpp\calc.S:11: Error: too many memory references for `mov' ..\plain_cpp\calc.S:12: Error: too many memory references for `mov' ..\plain_cpp\calc.S:13: Error: junk `h' after expression ..\plain_cpp\calc.S:13: Error: suffix or operands invalid for `int' ..\plain_cpp\calc.S:16: Error: too many memory references for `mov' ..\plain_cpp\calc.S:17: Error: too many memory references for `mov' ..\plain_cpp\calc.S:18: Error: junk `h' after expression ..\plain_cpp\calc.S:18: Error: suffix or operands invalid for `int' </code></pre> <p><strong>EDIT 2 - AT&amp;T Style</strong></p> <p><strong>PRO File</strong></p> <pre><code>TEMPLATE = app CONFIG += console CONFIG -= qt SOURCES += \ calc.S </code></pre> <p><strong>calc.S</strong></p> <pre><code>.data hello: .string "Hello World\n" .globl main main: movl $4, %eax movl $1, %ebx movl $hello,%ecx movl $12,%edx int $0x80 ret </code></pre> <p><strong>ERRORS</strong></p> <pre><code>undefined reference to `WinMain@16' collect2: ld returned 1 exit status </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload