i686-w64-mingw32-g++ Cannot link .obj produced by JWASM

208 Views Asked by At

Hello I'm trying to compile this program written for MASM:

.686
.xmm
.model flat, stdcall
OPTION CaseMap:None

include ../masm32/libs/windows.inc
include ../masm32/libs/kernel32.inc
includelib ../masm32/libs/kernel32.lib
include ../masm32/libs/user32.inc
includelib ../masm32/libs/user32.lib
includelib ../masm32/libs/msvcrt.lib

EXTERN printf:PROC

.data
    string1 db "Prova Prova Prova",0


.code

main PROC
    push ebp
    mov ebp,esp

    mov eax, offset string1
    push eax

    call printf

    pop ebp
    ret

main ENDP
    END

I'm making the object file with: jwasm -coff printf.asm

but when I try to compile with: i686-w64-mingw32-g++ -m32 printf.o

I get the following error:

Warning: .drectve -defaultlib:../masm32/libs/kernel32.lib ' unrecognized Warning: .drectve -defaultlib:../masm32/libs/user32.lib ' unrecognized Warning: corrupt .drectve at end of def file /usr/bin/i686-w64-mingw32-ld: /usr/lib/gcc/i686-w64-mingw32/10-win32/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o): in function main': ./build/i686-w64-mingw32-i686-w64-mingw32-crt/./mingw-w64-crt/crt/crt0_c.c:18: undefined reference to WinMain@16' collect2: error: ld returned 1 exit status

0

There are 0 best solutions below