Question:
Compile C code on Linux OS vs Windows?
2010-04-09 23:14:52 UTC
Hello,

I have a code that is written in C. I am using a Windows OS and have downloaded Cygwin with the gcc and make packages to compile my code. I am having problem after problem getting the code compiled. The code was previously working flawlessly on a Redhat Linux 7.1 system. If I were to compile the code on a Linux system (lets say fedora) how would I compile it since I wouldn't need Cygwin? I have not used Linux much but I will need gcc and the make command in order to execute my code.

Thanks,
Three answers:
husoski
2010-04-09 23:49:32 UTC
If you compile a program with Cygwin, you need to have access to the cygwin dll in order to run it. That's not a problem for me, since I put cygwin\bin in my system path variable, but it makes distributing code harder. Many prefer mingw for compiling pure windows targets using gnu development tools, for this very reason.



Yes, the CMD.EXE program gives you a shell under windows that is a superset of DOS and the old COMMAND.EXE from Windows 9x/Me days. It's normally in the Start menu under All Programs>Accessories. If you have cygwin\bin in your path, you can also mix in cygwin commands with CMD shell commands and executables. So, you can use dir or ls, ren or mv, etc.



You could compile under Linux, but the executable would have to run on Linux.



One cool way to get Linux working on a Windows host system is the free Sun (now Oracle) VirualBox software. I run Ubuntu this way, and it does pretty well. I haven't had luck with 3-D graphics acceleration, but everything else seems to work pretty well.
J.J.'s Advice / Avis de J.J.
2010-04-09 23:47:51 UTC
A program written for Linux wont necessarily work in Windows. It would have to be adapted to use Microsoft libraries and the Windows32 API.



Linux, of course, is based on a "command prompt" usually called a terminal or shell. The GUI desktop is just a fancy extra feature.
shanda
2016-06-01 06:26:43 UTC
Since Linux is Free and open source there are many free tools available in it. Where as Windows is More user Friendly with less tools. It all depends on you which operating system to use. If u r using your Personal Computer for home purpose than i suggest for windows. If u r using your Computer for business or learning purpose than i suggest that u use Linux since it has everything in it like mail server, webserver, Office tools, Firewall, Database Server, many programming and scripting languages, Development tools, CVS server, Hacking tools etc.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...