LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Creating .exe file with gcc in Linux, using Assembly (https://www.linuxquestions.org/questions/programming-9/creating-exe-file-with-gcc-in-linux-using-assembly-539461/)

davidguygc 03-21-2007 06:12 PM

Creating .exe file with gcc in Linux, using Assembly
 
Hi, I am in an Assembly language class this semester. The teacher wants us to submit the source as well as the .exe file. Now is it possible to produce a .exe file in Linux, even though it would not be able to use it?

I don't know why there would need to be a cross compiler, I'm already using assembly.

And, if there is no other way to produce a .exe file w/o a cross compiler, then how could I incorporate it into a makefile? I've never made a makefile, but I have simple instructions.

Thanks,
David

theNbomr 03-21-2007 06:38 PM

I assume you are going to run the .exe file under DOS or Windows. AFAIK, there is no GCC cross compiler for DOS targets. Under Linux, there is a cross assembler called NASM, which I'm pretty sure can generate DOS/Win object code (may require a DOS friendly linker).

--- rod.

davidguygc 03-21-2007 06:52 PM

yes, whenever I compiled back on windows heres what I'd do

For 32-bit:
Code:

%nasm32 -f coff foo.asm
%gcc -o foo.exe foo.o

For 16-bit:
Code:

%nasm16 -f obj foo.asm
%alink foo.o


ta0kira 03-24-2007 07:16 PM

Take a look at mingw32. This is a GCC port for compiling Windows programs.
ta0kira


All times are GMT -5. The time now is 03:14 PM.