Question:
Is there any advantage to programming in C under Windows vs. Linux?
Chris
2012-04-14 01:51:54 UTC
Is there any advantage to programming in C under Windows vs. Linux?
Nine answers:
ratter_of_the_shire
2012-04-14 06:32:33 UTC
More of the libraries and underlying systems of Linux are written in C. Besides that I can't really imagine so at least inherently. If you are targeting one specific platform, you probably want to use that platform to develop on.
Nick T
2012-04-15 21:04:18 UTC
The only real advantage of programming under windows is a larger user base, and there fore more customers for anything you produce.



In terms of compilers the two are pretty evenly matched, gcc is available on both platforms and is a close to the de facto standard C and C++ compiler as you are going to get.



Visual Studio is a marginally nicer environment than Eclipse but with the advent of managed code and C# it is not as user friendly for C or even C++ as it used to be. Personally I still prefer notepad++ and gcc on windows (and gedit or nc on linux) but thats just me...
peteams
2012-04-15 08:17:19 UTC
Windows offers a better development environment than Linux. All the tools available under Linux are available under Windows ("Linux" is really a kernel upon which GNU runs, GNU is available under Windows). Many tools, most significantly Visual Studio, are only available natively under Windows.



I've worked in environments where people were free to choose their development platform, provided it ended up compiling and running under both Windows and Unix. There was a clear enough difference between teams using Windows and teams using Linux that management eventually mandated Windows as the primary development environment.
Motorhead
2012-04-15 20:33:37 UTC
Windows is easier because Visual Studio gives a nice integrated editing, debugging, and running environment, with context sensitive help, instant syntax checking, intellisense prompts, etc.



But it also cost more, is much larger, and could be just a little confusing because of what it tried to give you as a starting program model.

So it depends on what you are going to be doing eventually?

If you are going to be doing windows programs, then use Visual Studio.

If you are going to be doing Linus, then use gcc and one of the free editors.
anonymous
2012-04-14 09:44:33 UTC
Actually, providing that you write standard-compliant C, your code will compile successfully on standard-compliant implementations of C on any platform. Though, with that said, I highly recommend programming on a Unix-like system. Most distributions come with a C compiler, an implementation of the C standard library, GNU make, a shell and various text editors. There are also numerous tools like gprof, splint, gdb, valgrind, cscope, and indent which are very helpful for writing C and can all be obtained easily on Unix-like systems. If you were to learn C on Windows you would be led towards using large IDEs which, in my opinion, aren't as effective as using individual programs.
Simply RED
2012-04-14 09:01:38 UTC
Are you aware that if you create a C program under Windows it won't run in Linux, and vice-versa? The program should be designed for a specific platform.
anonymous
2012-04-17 14:00:51 UTC
One huge advantage is the IDE, Visual Studio (running on Windows) is far superior to anything i have seen on Linux, trying to debug multi threaded application on Linux is an absolute pain as the debugger regularly crashes. The Visual Studio IDE is a pleasure to use and debugging programs is a breeze.



Here's the list of Editors/IDE/Debuggers i have used on Linux whilst developing software ranging from Set Top Boxes to Casino Games.



Slick Edit

Eclipse

GDB

Net Beans



Only SlickEdit comes close to VS but it still has the same problems with multi threading as it still uses gdb.
Shadow Wolf
2012-04-16 08:19:57 UTC
As far as learning C, not really any advantage. Learning to program in C, you'll be writing command line programs that should run with little or no trouble under Linux or DOS. By avoiding a few libraries and functions, there would be no trouble switching back and forth.



If you can deal with a 16 bit stub (DOSbox fixes this), DJGPP is the GNU/Linux C compiler and much more ported for DOS use. So in other words, you can get virtually all of the exact same tools found under Linux that will run under Windows/DOS. In fact, DJGPP is one way you can compile some Linux programs and have them run under WIndows/DOS. If you do get DJGPP, I also suggest getting RHIDE which is similar to the Borland IDE that was available at the time. Keep in mind that this is all free just like Linux.



If you are developing a Windows program, then obviously Windows is the platform. Similarly, If you are developing a Linux program, you should develop under Linux. The operating system determines where you want to develop usually.



However, if you want to develop something that will compile and run under both or many operating systems, you'll need to stick with the C standard and with minimal differences it should compile and run. If command line programs aren't enough, then you'll need to use one of the cross compatible libraries that are available. There are tons of programs that will compile for a variety of operating systems because someone took the time to port them and fix anything that was incompatible. C has a mechanism to selectively compile parts of the source code.



There is also the option of using an emulator such as WINE under Linux to run some Windows programs. It isn't the best solution but it works for many programs.



So, is there really an advantage? There isn't an answer. There are C programs that will compile under over a dozen variants of different operating systems. To manage this, each program is dynamically modified so that it actually compiles for the specific operating system. Which means that someone had to test and fix the problems for every operating system using the target operating system and the tools available.



Shadow Wolf
Jim
2012-04-15 01:46:16 UTC
if you create a program in windows it will run in linux under WINE and under mac under DarWINE, but if you create it for linux it will only run under flavors of linux, and if only on mac it will only run on mac, freebsd then possibly only on freebsd (it MAY run on other flavors of BSD).



I have run my windows programs successfully under linux, complete with NSIS installers.



there ARE platform-independent libraries/toolkits out there you can use - wikipedia lists one search for cross-platform.


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