Question About Compiling C Programs in Windows XP

The geek forum. PHP, Perl, HTML, hardware questions etc.. it's all in here. Got a techie question? We'll sort you out. Ask your questions or post a link to your own site here!

Question About Compiling C Programs in Windows XP

Postby Dante » Fri Jul 25, 2008 5:31 pm

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
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!

Postby Midori » Fri Jul 25, 2008 10:11 pm

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.
User avatar
Midori
 
Posts: 1805
Joined: Mon Sep 12, 2005 6:43 pm
Location: Mingling with local sentients

Postby Warrior4Christ » Sun Jul 27, 2008 6:22 am

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...
Everywhere like such as, and MOES.

"Expect great things from God; attempt great things for God." - William Carey
User avatar
Warrior4Christ
 
Posts: 2045
Joined: Sat Aug 20, 2005 8:10 pm
Location: Carefully place an additional prawn on the barbecue

Postby Technomancer » Wed Jul 30, 2008 11:52 am

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.
The scientific method," Thomas Henry Huxley once wrote, "is nothing but the normal working of the human mind." That is to say, when the mind is working; that is to say further, when it is engaged in corrrecting its mistakes. Taking this point of view, we may conclude that science is not physics, biology, or chemistry—is not even a "subject"—but a moral imperative drawn from a larger narrative whose purpose is to give perspective, balance, and humility to learning.

Neil Postman
(The End of Education)

Anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that my ignorance is just as good as your knowledge

Isaac Aasimov
User avatar
Technomancer
 
Posts: 2379
Joined: Fri Jun 13, 2003 11:47 am
Location: Tralfamadore

Postby Midori » Thu Jul 31, 2008 2:10 pm

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.
User avatar
Midori
 
Posts: 1805
Joined: Mon Sep 12, 2005 6:43 pm
Location: Mingling with local sentients

Postby Kaligraphic » Thu Jul 31, 2008 4:22 pm

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++.)
The cake used to be a lie like you, but then it took a portal to the deception core.
User avatar
Kaligraphic
 
Posts: 2002
Joined: Wed Jul 21, 2004 12:00 pm
Location: The catbox of DOOM!

Postby Warrior4Christ » Fri Aug 01, 2008 7:07 pm

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
Everywhere like such as, and MOES.

"Expect great things from God; attempt great things for God." - William Carey
User avatar
Warrior4Christ
 
Posts: 2045
Joined: Sat Aug 20, 2005 8:10 pm
Location: Carefully place an additional prawn on the barbecue

Postby blkmage » Sat Aug 02, 2008 11:21 am

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.
User avatar
blkmage
 
Posts: 4529
Joined: Mon May 03, 2004 5:40 pm

Postby Midori » Sat Aug 02, 2008 6:24 pm

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.
User avatar
Midori
 
Posts: 1805
Joined: Mon Sep 12, 2005 6:43 pm
Location: Mingling with local sentients

Postby Dante » Sat Aug 02, 2008 8:22 pm

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 :P)

THANK YOU!!!!! YES!
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!

Postby Kaligraphic » Sat Aug 02, 2008 8:54 pm

Guys, this site has a "no religious arguments" policy, so it's probably better to let the whole Perl vs Python thing lie.
The cake used to be a lie like you, but then it took a portal to the deception core.
User avatar
Kaligraphic
 
Posts: 2002
Joined: Wed Jul 21, 2004 12:00 pm
Location: The catbox of DOOM!

Postby Warrior4Christ » Sat Aug 02, 2008 10:16 pm

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.)
Everywhere like such as, and MOES.

"Expect great things from God; attempt great things for God." - William Carey
User avatar
Warrior4Christ
 
Posts: 2045
Joined: Sat Aug 20, 2005 8:10 pm
Location: Carefully place an additional prawn on the barbecue

Postby blkmage » Sat Aug 02, 2008 10:39 pm

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.
User avatar
blkmage
 
Posts: 4529
Joined: Mon May 03, 2004 5:40 pm

Postby Dante » Sun Aug 03, 2008 8:10 pm

Really... THANK GOD!!! :big sigh of relief:
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!


Return to Computing and Links

Who is online

Users browsing this forum: No registered users and 221 guests