Programmer
Programmer

Reputation: 6753

Programming in c using cygwin

I was planning to program in c using cygwin on windows. Does this have any performance drawbacks when compared to using gcc in ubuntu?

Upvotes: 1

Views: 2718

Answers (3)

goldenmean
goldenmean

Reputation: 19046

Few more things to understand:

GCC-Cygwin:

Pros -

  1. Compiling C code using gcc under cygwin would generate a windows executable, which uses the cygwin.dll(Posix emulation layer) linked dynamically into your app/code. So if you need to execute this app from some other path or other windows machine, that should have cygwin installed and in its path else you get error.

  2. Cygwin provides a benefit in that, if you have a POSIX compliant code developed on Linux-gcc you can compile it with no changes at all(very little changes in some case) on windows. So it kind of provides Posix compatibility on windows.

Cons -

  1. If you are going to run some which is going to consume heavy system resources(memory,CPU) then not sure how cygwin would scale up as compared to a native executable on Linux.

  2. Sometimes, Debugging using ddd on cygwin, I have found some weird crashes/hang of the ddd.

GCC-Linux:

  1. If your final app is going to be executing on Linux, it makes sense to compile, and debug it under the same environment. Linux-gcc.

  2. For Debugging , linux would provide you lot of tools (gdb/ddd, valgrind), etc.

  3. If you want to accelerate some critical protion of code, using inline assembly with gcc under linux is nicely defined and has no issues working.(Udner Cygwin, i have faced sometimes that getting a inline assembly compiled was a problem)

  4. If you want to add multiple threads for execution on multiple processors/cores, then pthreads comes to your help(Not sure about the same udner cygwin)

Upvotes: 0

Duncan Bayne
Duncan Bayne

Reputation: 3959

I've used Cygwin on Windows 7 and Windows 2008 R2 for C development. The experience was painful: not only slow, but I never did manage to get my preferred editor (Emacs) working properly in Cygwin.

You could try a live distro of Linux that you could boot from a USB memory stick. That way you could program in C to your heart's content without having to install any software on your PC. I'd recommend Puppy Linux if you took that approach.

Alternatively, you could install a virtualisation product (like VirtualBox) and create a Linux VM. In that case, I'd suggest using Ubuntu.

My experience is that either the live distro or VM approach would be better than using Cygwin as a development environment.

Upvotes: 4

Keith Nicholas
Keith Nicholas

Reputation: 44316

You won't get the exact same performance. But whether this is a drawback or not depends on what you are doing.

Upvotes: 0

Related Questions