To make .exes in linux
To make .exes in linux
Hi.
Could you give me a simple makefile example of how can I compile my C-programs into ms-exe on linux?
(I have gcc, ld and all that)
(I need this information because the one I am teaching to program, uses Windows95 and we write the programs here, with my Linux)
I don't think that's very difficult when I just need to use stdandard C libs; doesn't DOS use them also?
Could you give me a simple makefile example of how can I compile my C-programs into ms-exe on linux?
(I have gcc, ld and all that)
(I need this information because the one I am teaching to program, uses Windows95 and we write the programs here, with my Linux)
I don't think that's very difficult when I just need to use stdandard C libs; doesn't DOS use them also?
Re:To make .exes in linux
The problem is that Windows executables have a different format (PE) than Linux (ELF). Also, the C standard lib you have installed under Linux has the same API as the one on Windows, on the front side, but on the back side it calls Linux kernel functions... so that doesn't help either.
You need a cross-compiler. If you are lucky, your Linux distro of choice offers a Mingw32 package; if not, you will have some tinkering to do...
You need a cross-compiler. If you are lucky, your Linux distro of choice offers a Mingw32 package; if not, you will have some tinkering to do...
Every good solution is obvious once you've found it.
Re:To make .exes in linux
MingW32 is, basically, a GCC generating Windows executables. Last time I looked, www.mingw.org held the docs. Which part gives you trouble?
Every good solution is obvious once you've found it.
Re:To make .exes in linux
The problem is that I don't get the purpose and usage of mingw at all, and the docs didn't help. If I write mingw or mingw32 to the command line: "command not found", even I installed the rpm succesfully. Has it some relationships with GCC? If has, how can I get GCC to produce exe-format?
(I don't think that's more complicated than a single commad line, but could you tell me it?)
(I don't think that's more complicated than a single commad line, but could you tell me it?)
Re:To make .exes in linux
How about the way GCC does all cross compilers:
i686-pc-mingw32-gcc -o something.exe something.o
You would obviously be able to find out what the proper name for the compiler program is by looking in /usr/bin [or /bin]...
i686-pc-mingw32-gcc -o something.exe something.o
You would obviously be able to find out what the proper name for the compiler program is by looking in /usr/bin [or /bin]...
Re:To make .exes in linux
You haven't read the docs.OSMAN wrote: ...the docs didn't help...
Has it some relationships with GCC?
Every good solution is obvious once you've found it.
Re:To make .exes in linux
So cruel, but yet... so true.Solar wrote: You haven't read the docs.
Re:To make .exes in linux
No need to waste your time on something that can be easily explained and helped. Even shorter would be RTFM, but most people are offended by it nowadays.Eero R?nik wrote: So cruel, but yet... so true.
Re:To make .exes in linux
Amazing, but true, and my own fault.
BUT DOES... let's calm down... but does:
$ gcc -c hello.c
produce hello.exe as they say at mingw.org?
I don't think so; it's a.out.
With the energy you have wasted by telling me "Haven't read the docs", you could have told me the command line twice.
BUT DOES... let's calm down... but does:
$ gcc -c hello.c
produce hello.exe as they say at mingw.org?
I don't think so; it's a.out.
With the energy you have wasted by telling me "Haven't read the docs", you could have told me the command line twice.
Re:To make .exes in linux
No we couldn't.OSMAN wrote: Amazing, but true, and my own fault.
BUT DOES... let's calm down... but does:
$ gcc -c hello.c
produce hello.exe as they say at mingw.org?
I don't think so; it's a.out.
With the energy you have wasted by telling me "Haven't read the docs", you could have told me the command line twice.
By reading the docs you will gain a deeper understanding of how stuff works, and without this sense of how it works you will NEVER, I repeat, NEVER, create a decent OS that is in fact your own. You will never belong to the top bit of programmers that can help you with problems and that can solve things that people consider unsolvable or very hard.
We could read the doc, figure out what's meant by it and tell you. If we did that, you would come here next time and complain "the program I compiled doesn't run in linux" or some other question (emphasis on it being a question that is also pretty much described in documents which you haven't read). We'd keep answering your questions for you, you wouldn't learn a thing and you'd be wasting our expensive time.
Now, if you have a question that isn't answered in accompanying documents, we're more than happy to help you since it isn't a waste of our time then.
PS: final answer: No it keeps producing Linux executables (which are very probably elf files). It would be very stupid to replace your system compiler with a cross compiler.
Re:To make .exes in linux
This windows-exe thing has nothing to do with my OS, that's why I'd rather read documentation about system programming than getting deeper into some minwg32 docs. I just have a friend who'd like to run the helloworld-dos-programs we write in my house on his computer with Windwz. Now the thing is, that I'm not like that I'd just be not reading the manuals and asking everything from you right away; but as I mentioned, producing exes in linux, I just wanted to know the command line option for it without studying everything about it. But I guess that wasn't as simple as that then. And we can run the elfs here so no problem.
Re:To make .exes in linux
Actually, it was as simple as that. I mean, AR posted everything you wanted to know, if you bothered to scroll up a bit and look at his post.
Re:To make .exes in linux
There's a hint hidden in my distinguishment of "system compiler" with "cross compiler". Which does normal "gcc" invoke?