Page 1 of 1
Question About Compiling C Programs in Windows XP
PostPosted: Fri Jul 25, 2008 5:31 pm
by Dante
Ok,
So apparently the entire programming world has moved to Linux and left me behind on my happy PCs. Within science the two favorite programming languages in use are Python and C. God in his Heaven only knows WHY they like to use C, but they do. Python I can handle because I can grab the compilers for it as easily as I could C#.NET, Java or VB.NET for Windows (The other languages they apparently "don't use"
I'll still use them to model though because they are REALLY nice to work with (Especially Java for applets)).
MY QUESTION IS THIS!: If I have a .c file written on my computer using (shivers) notepad... HOW does one compile this c class, or where can I get a compiler that's a one time download and install (aka .exe for WINDOWS XP) I just want a standard compile and not a gazzilion options as command prompt is disgusting to work with as it is. But all I'm finding are things like GNU which require a million other libraries to base their work off of and complicated installation instructions or working instructions. I JUST WANT TO PRESS A SINGLE BUTTON WHEN I FINISH MY CODE (It doesn't work if you don't put everything in the right order anyways)!
Rant: @_@ If I wanted to go through so much work, I'd just download Linux, but I use XP so... yeah.
-Pascal
PostPosted: Fri Jul 25, 2008 10:11 pm
by Midori
It seems all the C compilers for windows are either command-line only or complete full-featured development environments. What looks perhaps the best from what I've read is
LCC.
I can't blame you at all for disliking the Windows command prompt. A large advantage for me of my switching to Linux was to have a good command line interface that wasn't completely bletcherous.
Pascal wrote:Within science the two favorite programming languages in use are Python and C.
I think there's quite a bit of the scientific community that uses Perl, and to a lesser extent Lisp. But a lot of organizations like NASA still write all their scientific stuff in Fortran.
PostPosted: Sun Jul 27, 2008 6:22 am
by Warrior4Christ
1. C doesn't have classes. It compiles to executable binaries.
2. You're probably already aware, but GCC is pretty much the standard. On Windows, it comes as Cygwin (large UNIX-like environment which is VERY useful if you do a lot of that type of thing) or MSYS with MinGW (smaller UNIX-like environment, but still requires downloading a number of separate packages). However, both of these are of course command line ones.... Sorry, I don't really know any nice smaller non-command line (semi-IDE?) ones.
3. Python is newer and generally regarded as being better than Perl. I've never actually used either, but it's the general impression I get from reading stuff. C is a nice low-level language, so you know exactly what's happening... Python is more a scripting language, so it's entirely different and less efficient...
PostPosted: Wed Jul 30, 2008 11:52 am
by Technomancer
I'd look for some form of IDE-based system. Borland C++ builder is goo, but not well supported and some of the binaries are in a funny format. VC++ is supposed to be good as well, but I haven't used it. Basically, some kind of windows interface is desireable since it makes project management and options control a good deal easier.
PostPosted: Thu Jul 31, 2008 2:10 pm
by Midori
Warrior4Christ (post: 1248541) wrote:Python is newer and generally regarded as being better than Perl.
Ooh, them's fightin' words! Python programmers certainly think Python is better than Perl.
(Off topic, sorry)
The advantage to using Cygwin or MinGW is getting a command line that is NOT disgusting to work with. But they're a lot of trouble to set up, in my experience. Harder than setting up a dual-boot with Linux, anyway.
PostPosted: Thu Jul 31, 2008 4:22 pm
by Kaligraphic
Actually, CLI-wise, anyone who has to use Windows on a technical level these days should be using Powershell by now. cmd.exe is basically just command.com with a few upgrades. Powershell is the way to go for MS shells. If you just can't leave your old shell behind, though, I know that bash and csh have Win32 ports. If you prefer something else, that probably has one too.
For compilers, I haven't done straight C in quite a while (mid-90s), but I used bcc back then, and it worked well enough. I've heard there's a legit version of it floating around freely available somewhere, too. For a more MS option, you could try Visual C++ Express, which may also be able to compile straight C. (Many C++ compilers also understand C, differentiating by file extension. .c for C source files, .cpp for C++.)
PostPosted: Fri Aug 01, 2008 7:07 pm
by Warrior4Christ
Midori (post: 1249961) wrote:Ooh, them's fightin' words! Python programmers certainly think Python is better than Perl.
(Off topic, sorry)
My main source was:
http://avatraxiom.livejournal.com/58084.html
PostPosted: Sat Aug 02, 2008 11:21 am
by blkmage
I can't think of anything that Perl can do that Python can't, and Python has the advantage of making everything really easy to do, having an excellent standard library, and being syntactically clean and simple.
PostPosted: Sat Aug 02, 2008 6:24 pm
by Midori
I can't think of anything that Python can do that Perl can't, and Perl has the advantage of making everything really easy to do, having an excellent user-contributed library, and being syntactically expressive and versatile.
But we could argue about this for pages and pages and not get anywhere.
PostPosted: Sat Aug 02, 2008 8:22 pm
by Dante
I can't think of anything that Python can do that Perl can't, and Perl has the advantage of making everything really easy to do, having an excellent user-contributed library, and being syntactically expressive and versatile.
But we could argue about this for pages and pages and not get anywhere.
I can think of things that C# and Java can do that Python and C can't, abstract classes
... for that matter it fails at encapsulation, polymorphism and therefor to me EVERYTHING. All the same, they are going to require me to use it which is sad... and I may have to find some hack way of doing what I had done before with abstract classes and encapsulation in order to make my programs simpler and work better.
A) I like to split my methods into nice neat sub-methods... but then I make them all private and only let the user access certain public methods. Python has no private encapsulation abilities, so all of my worthless mini-methods are going to confuse the livin ducks out of anyone trying to use my classes.
B) I was getting away with symbolic programming in C#.NET by making the symbolic stuff an abstract method completed in another class... then you just have to call the abstract class a bunch of times and it does some numerical work on the abstract method... you don't have to know how it works, it just does it!... Can't do this in Python
... no abstract classes.
C)Why must they force me to use float when double is standard and decimal may be soon.
And why does it forbid me from braces or writing in encapsulation terms... I mean, not requiring them is one thing, but not supporting them is driving me crazy! (Plus it makes me think twice whenever I want to format my code for easier reading when I press tab.
(Almost) END OF PYTHON RANTS... PASCAL WILL JUST HAVE TO BECOME A MORE... "IMAGINATIVE" PROGRAMMER... EXPECT VAST SPEGGETI CODE IN THE NEAR FUTURE THAT QUALIFIES FOR THE GUINNESS BOOK OF WORLD RECORDS HACK AWARD.
Ok, so I'm going to give the worlds smallest C compiler a shot now... (Crosses fingers)
New file test...
#include <stdio.h>
int main (void) //Doesn't this look familiar... where is the static or string[] though?
{
printf ("Hello World\n");
return 0;
}
YAY!!!! IT WORKS THANK YOU!!! (At this rate given the difficulties I had with Python I might actually build the whole thing in C, its faster right
)
THANK YOU!!!!! YES!
PostPosted: Sat Aug 02, 2008 8:54 pm
by Kaligraphic
Guys, this site has a "no religious arguments" policy, so it's probably better to let the whole Perl vs Python thing lie.
PostPosted: Sat Aug 02, 2008 10:16 pm
by Warrior4Christ
Pascal (post: 1250559) wrote:I can think of things that C# and Java can do that Python and C can't, abstract classes
...
C isn't Object Oriented at all... no point in comparing it!
[quote="Pascal (post: 1250559)"]#include <stdio.h>
int main (void) //Doesn't this look familiar... where is the static or string[] though?
{
printf ("Hello World\n")]
If you want command line arguments, use this instead:
int main (int argc, char **argv)
(There are no strings in C. Just arrays of chars.)
PostPosted: Sat Aug 02, 2008 10:39 pm
by blkmage
Every language is different in terms of the assumptions that they make about the programmer and its conventions. It's the same as in human languages; you can't really know them just by learning the syntax. You can't expect to write something like you would in Java and expect it to work exactly the same in other languages. That's why they're not Java.
For example, C has no objects or classes. Everything you learned about encapsulation and abstraction doesn't really apply. Python, on the other hand, doesn't really support encapsulation either, but for the reason that it assumes that the user is smart enough not to mess around and break things, so it lets you write without having to worry about that.
Also, floats in Python are C doubles.
PostPosted: Sun Aug 03, 2008 8:10 pm
by Dante
Really... THANK GOD!!! :big sigh of relief: