'Compiling a C++ program using x86_64-w64-mingw32-gcc on Linux

I am having issues compiling my C++ program on Linux using x86_64-w64-mingw32-gcc. My program is comprised of of the following files: one cpp file, two header files, and an asm file. I am using the following command to compile a x64 PE file:

x86_64-w64-mingw32-gcc test.cpp -c test.asm l kernel32 -l user32 -l gdi32 -l winspool -l crypt32 -l comdlg32 -l advapi32  -l shell32 -l ole32 -l oleaut32 -l uuid -l odbc32 -l odbccp32 -I . -o test.exe

I've also tried using g++ using the following syntax, but it states that the it can't find windows.h:

g++ test.asm test.cpp -o test.exe

When I run the executable, it just tells me that it is not compatible with my operating system. Could someone please point out what is wrong with my syntax? It also doesn't seem to be linking the ASM file either.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source