LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-21-2007, 06:12 PM   #1
davidguygc
Member
 
Registered: Jul 2004
Location: Lubbock, Texas
Distribution: Slackware 12.0 with Beryl 0.2.1
Posts: 334

Rep: Reputation: 30
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
 
Old 03-21-2007, 06:38 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 03-21-2007, 06:52 PM   #3
davidguygc
Member
 
Registered: Jul 2004
Location: Lubbock, Texas
Distribution: Slackware 12.0 with Beryl 0.2.1
Posts: 334

Original Poster
Rep: Reputation: 30
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
 
Old 03-24-2007, 07:16 PM   #4
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Take a look at mingw32. This is a GCC port for compiling Windows programs.
ta0kira
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating/Converting Windows exe to Linux sfcesario Programming 6 08-19-2006 07:27 AM
inline assembly in gcc gursev Programming 2 03-04-2005 02:17 AM
How may I tell gcc to generate an assembly file? LongName Programming 4 08-30-2004 02:31 AM
gcc and creating a debug file xviddivxoggmp3 Programming 5 03-16-2004 03:38 PM
creating a flat binary file with gcc wsimmons Programming 2 01-08-2002 11:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration