LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-21-2003, 06:19 PM   #1
Randall
Member
 
Registered: Oct 2001
Location: Ontario, Canada (for now, i'm from NJ )
Distribution: Redhat 7.2
Posts: 106

Rep: Reputation: 15
gcc


I was wondering how do i activate or get to use gcc? i know it is there i chose the development package and i did gcc -dumpversion and it returned 3.2 but everytime i type gcci get
gcc: no input files.

and another question if i had to write a program in c what would i use??
 
Old 01-21-2003, 06:21 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
you won't run gcc directly, it is used when you install programs from source (tar.gz files). search this site for info on hwo to install them
 
Old 01-21-2003, 07:24 PM   #3
Randall
Member
 
Registered: Oct 2001
Location: Ontario, Canada (for now, i'm from NJ )
Distribution: Redhat 7.2
Posts: 106

Original Poster
Rep: Reputation: 15
sorry but i didn't see what site that was
 
Old 01-22-2003, 02:36 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
huh? **THIS** site....
 
Old 01-22-2003, 07:48 PM   #5
yngwin
Member
 
Registered: Dec 2002
Location: China
Distribution: Arch
Posts: 359

Rep: Reputation: 33
Well, he already said he has gcc installed
To write a c program you could use any text editor. It seems emacs is popular.
 
Old 01-22-2003, 08:40 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,259

Rep: Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624
gcc is a console command line compiler.
There are several text editors.
vi, emacs, KDE has several

Create a c program using a text editor i.e hello.c
To compile it
gcc -o hello hello.c

To execute it:
./hello

There are also IDE's like KDevelop.
 
Old 01-22-2003, 10:55 PM   #7
Randall
Member
 
Registered: Oct 2001
Location: Ontario, Canada (for now, i'm from NJ )
Distribution: Redhat 7.2
Posts: 106

Original Poster
Rep: Reputation: 15
i ran into a whole bunch of errors when i tried to do that

stangely
i typed in cc blah.c -o blah.exe
./blah.exe
and it worked

if i used gcc -o execname -c blah.c
i got permission errors and can't execute binary files errors
i was able to change the permission error with chmod a+x execname but that still left the binary file error.

i tried using emacs as the editor but it kept giving me buffer errors so i used vi and that worked just great for me !

thanks for all your suggestions and help
it was most helpful and informative.


the learning process continues.....
 
Old 01-23-2003, 02:12 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
.exe????
 
Old 01-23-2003, 08:29 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,259

Rep: Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624
Almost there with gcc

Quote:
Originally posted by Randall

gcc -o execname -c blah.c
The -c option does not link and therefore there isn't an executable file. man gcc for command line options or search for additional help on the web. The -o option is what you want the executable to be named otherwise the default is a.out. Since linux doesn't care about names no extension is required. Based on my example

gcc -o execname blah.c

to execute
./execname

As you say the learning process continues.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 03:13 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 12:38 PM
running software built with gcc 3.0.2 on Redhat 8 - gcc 3.2 dst1989 Linux - Software 3 03-08-2004 11:23 PM
a doubt with host gcc and arm-linux-gcc renjithgopal Linux - General 1 09-11-2003 05:02 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 01:07 AM


All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration