C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 23rd, 2003, 12:42 PM
jayshah11 jayshah11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 jayshah11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 29 sec
Reputation Power: 0
Send a message via Yahoo to jayshah11
C compiler needed

I would like to know what it takes to write C programs, compile and run them.

I think C compiler is required. Can i get it from anywhere for free and would like to know what else is required.

Reply With Quote
  #2  
Old April 23rd, 2003, 01:54 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is online now
Contributing User
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 6,138 dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 3 Days 21 h 36 m 57 sec
Reputation Power: 1974
Oh, yes, a C compiler is a very definite must. As for running the program, compiling it produces an executable file, so you just run that executable at the command line.

Before we can recommend a free C compiler, we need to know what OS you are running.

If Linux, then you should already have the GNU C compiler installed, gcc. If not, then it should be on your distro CDs, in which case you will have to install it and its development libraries. If it is not on the distro CD (I encountered that with ManDrake 7.2; gcc was only on the more expensive Power-User distro), then you will need to download it.

If you are running Mac OS X, then you are actually running FreeBSD. I've not worked with FreeBSD, but I assume that it comes with a C compiler -- I just don't know what it would be called (cc?). You would have to do all this from the terminal, I'm sure.

Safest bet is that you are running Windows, in which case you have a few options available.

If you feel more comfortable with a brand name, Borland offers version 5.5 (Aug 2000) of their C++ compiler and command-line tools for free download. Go to http://www.borland.com/products/dow...d_cbuilder.html . I found their on-line registration a bit of a hassle. In addition, you'll get the 32-bit version of grep and a few other command-line utilities. Note that you will also be able to compile both C and C++ programs with this compiler.

Another free C compiler is lcc-win32 at http://www.cs.virginia.edu/~lcc-win32/ . Please note that this is C only, not C++. Even if you don't use lcc-win32, a visit to their site would still be worth your while for the documentation and C tutorial that they offer.

Another free C/C++ development environment that is widely recommended on this forum (that's where I learned about it) is Dev-C++ by Bloodshed Software at http://www.bloodshed.net/ . It's a fairly complete IDE that uses the MinGW port of gcc to Windows.

If all you want is the compiler itself, then you can download MinGW's gcc directly from their site at http://www.mingw.org/ .

Share and enjoy!

Reply With Quote
  #3  
Old April 23rd, 2003, 04:32 PM
jayshah11 jayshah11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 jayshah11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 29 sec
Reputation Power: 0
Send a message via Yahoo to jayshah11
C Compiler

I am using Windows XP as my operating System. I have Pentium 4. Suggest me the exact procedure. And thank you very much for your help.

Reply With Quote
  #4  
Old April 23rd, 2003, 06:43 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is online now
Contributing User
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 6,138 dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 3 Days 21 h 36 m 57 sec
Reputation Power: 1974
Well, then, that boils it down to Borland, lcc-win32, or Dev-C++. Pick one and perform the installation.

Borland will be strictly command-line, AKA "DOS" AKA "Command Prompt". You know, that icon that Microsoft keeps burying deeper and deeper trying to hide it from us. You would most likely need to create and use a makefile for it, which adds an extra layer of complexity. So Borland might not be your best bet.

lcc-win32 and Dev-C++ both provide you with a GUI integrated development environment (IDE), which gives you an editor, dialogs for setting up your projects, allows you to run the compiler from within the IDE, displays error messages, and (usually) takes you straight to the line of code that caused the error. They also usually include a debugger.

Dev-C++ appears to be used more widely here than lcc-win32, so more help should be available with it. Also, when you want to move on to C++, you'll already have a compiler and IDE that you're familiar with (remember, lcc only does C). And if you want to do it all from the command-line instead (my personal choice, but then I'm an old DOS'er from before Windows v1.0 and a Linux neophyte), then I can step you through that for Dev-C++.

Dev-C++'s stable version is Version 4 and its Version 5 is in beta. There have been reports here of v5 having problems under XP, whereas others report that they use v4 under XP with no problems at all. So if you go with Dev-C++, I would recommend that you start out with version 4.

Once you download the software, simply follow the instructions on the web page and/or in the readme file.

Reply With Quote
  #5  
Old April 24th, 2003, 06:31 AM
jayshah11 jayshah11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 jayshah11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 29 sec
Reputation Power: 0
Send a message via Yahoo to jayshah11
Error in Dev-C++ 4

I did download the version 4 and wrote a small C program but while compiling i am getting an error that

instalation problem, cannot exec 'gcc': No such directory

can't exec 'gcc': No such file or directory

Guide me on this one. What can be wrong?

Reply With Quote
  #6  
Old April 24th, 2003, 06:41 AM
jayshah11 jayshah11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 jayshah11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 29 sec
Reputation Power: 0
Send a message via Yahoo to jayshah11
Visual Studio 6

Can i use Visual C++ to write my C programs and run them?

Reply With Quote
  #7  
Old April 24th, 2003, 08:25 AM
Jason Doucette's Avatar
Jason Doucette Jason Doucette is offline
jasondoucette.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Canada
Posts: 378 Jason Doucette User rank is Private First Class (20 - 50 Reputation Level)Jason Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 h 23 m 8 sec
Reputation Power: 11
Yes.

Reply With Quote
  #8  
Old April 24th, 2003, 10:42 AM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is online now
Contributing User
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 6,138 dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 3 Days 21 h 36 m 57 sec
Reputation Power: 1974
Quote:
Originally posted by jayshah11
I did download the version 4 and wrote a small C program but while compiling i am getting an error that

instalation problem, cannot exec 'gcc': No such directory

can't exec 'gcc': No such file or directory

Guide me on this one. What can be wrong?


It looks like Dev-C++ cannot find gcc, which doesn't make any sense to me. gcc should have been installed and Dev-C++ should know where to find it.

Now, I assume that you are doing the compile from within the IDE -- but of course, DOS would report "Bad command or file name", unless they changed that for XP.

Dev-C++ should have created a directory off the root called dev-c++ . In that directory there should be a subdirectory called bin . Look inside that directory (\dev-c++\bin) and verify that the file, gcc.exe, is there. If it is not, then somehow the installation did not work and you would need to reaccomplish it.

BTW, if you were trying to run gcc from the command line, then you will need to add \dev-c++\bin with its drive letter to the search path; eg,
PATH=C:\Dev-C++\bin;%PATH%
You should not need to do this if you are compiling within Dev-C++.

Quote:
Originally posted by jayshah11
Can i use Visual C++ to write my C programs and run them?


You had originally specified "free", so I did not mention Visual C++ -- Bill Gates was one of the first ones to strongly advocate non-free software.

VC++ is strongly oriented towards GUI apps, but you can create console apps with it. When you do a File | New to call up the New dialog, under the Projects tab select "Win32 Console Application", give it a project name and location, and click OK. Select "An empty project" and click on Finish and then OK on the verification dialog. Now create a new text file, save it as a .C file, and add it to the project (Project | Add to Project | Files). When you compile the program, the .exe file will be in the debug subdirectory -- I normally open a DOS window and cd to that subdirectory to run the program.

That's how I used to do all my network programs until I started using Dev-C++'s gcc -- from the command line, of course.

Last edited by dwise1_aol : April 24th, 2003 at 10:45 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > C compiler needed

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap