You are not logged in.

#1 2010-10-08 18:06:16

dragos240
Member
Registered: 2009-05-23
Posts: 189

Compile windows program in linux, output to elf.

I can compile a windows program in mingw32, but it's exported in exe format. Can I compile it to elf format? If so, how?

Offline

#2 2010-10-08 20:05:54

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: Compile windows program in linux, output to elf.

Why would you? Windows does not support ELF format.

Offline

#3 2010-10-08 21:46:44

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: Compile windows program in linux, output to elf.

I'm trying to use mingw32 to compile a windows native c file, but it compiles to exe. I am using linux. So....

Offline

#4 2010-10-08 21:54:36

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,294

Re: Compile windows program in linux, output to elf.

dragos240 wrote:

I'm trying to use mingw32 to compile a windows native c file, but it compiles to exe. I am using linux. So....

... So, why not just compile it with gcc ? 

If it is because you need some library (like a dll), you will need to find a Linux equivalent [and probably need some code changes]


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2010-10-08 22:06:05

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: Compile windows program in linux, output to elf.

Yeah, I tried native gcc. Not working >.<

Offline

#6 2010-10-09 01:47:44

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: Compile windows program in linux, output to elf.

If you just want to compile a windows dll with mingw, you'd do this

i486-mingw32-gcc -o foo.dll -shared foo.c

If you just want to compile the file, but not link, you can do

i486-mingw32-gcc -c foo.c -o foo.o

It's kinda hard to figure out what you actually want though.

Offline

#7 2010-10-09 05:48:50

Anikom15
Banned
From: United States
Registered: 2009-04-30
Posts: 836
Website

Re: Compile windows program in linux, output to elf.

Are you trying to make a Linux program with Windows C code? That won't work because Windows has different libraries than UNIX, among other inconsistencies between the platforms. What kind of GCC errors are you getting?


Personally, I'd rather be back in Hobbiton.

Offline

Board footer

Powered by FluxBB