LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-02-2003, 07:16 PM   #1
jacksmash
Member
 
Registered: Nov 2003
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 269

Rep: Reputation: 30
Problems running C with gcc!!


Hi,

I'm tring to run a simple C program under RedHat Linux 9.0.
I have a program which I've called "sqaure.c"
If I compile it using gcc,
ie. "gcc square.c"
I then get the a.out file. But if I try to run it by typing "a.out" I just get "command not found".

I'm just starting to learn C, so I may be overlooking something simple here, but please help if you can!

Thanks
 
Old 11-02-2003, 07:21 PM   #2
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
try typing `./a.out` (assuming your in the current directory of the 'a.out' file...)
secondly, you can tell gcc what to output by using the '-o' switch....

`gcc -o square square.c`

and run that with `./square` (once again , assuming your in the directory that the 'square' file is in)
 
Old 11-02-2003, 07:23 PM   #3
jacksmash
Member
 
Registered: Nov 2003
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 269

Original Poster
Rep: Reputation: 30
Thanks a bunch!
 
  


Reply



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
running gcc or cc MI3GTO Linux - Newbie 3 02-28-2005 04:23 PM
compiling & running java using gcc kiran_kondru17 Linux - Newbie 1 01-04-2005 11:49 AM
running Maya6 on gentoo with gcc 3.3.4 asmith Linux - Software 0 11-28-2004 06:13 AM
running software built with gcc 3.0.2 on Redhat 8 - gcc 3.2 dst1989 Linux - Software 3 03-08-2004 10:23 PM
Fedora running VMware/GCC compiling atko Fedora 3 12-14-2003 06:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:58 AM.

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
Open Source Consulting | Domain Registration