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 05-05-2011, 07:06 PM   #16
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282

[code]some code here[/code]
will result in
Code:
some code here
And we can not tell you what's wrong without seeing the new program
 
Old 05-05-2011, 07:42 PM   #17
archie101
Member
 
Registered: Apr 2011
Location: u.s
Distribution: arch linux
Posts: 48

Original Poster
Rep: Reputation: 0
my program is
Code:
#include <stdio.h>

int main(void) {

printf("hello");

}
and the error is
Code:
gcc: error: c.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
do i have to take the .c off?

sorry for my knowing nothingness i am used to using a windows compiler.

Last edited by archie101; 05-05-2011 at 07:49 PM.
 
Old 05-05-2011, 07:52 PM   #18
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
gcc can't find your file. Did you specify the right path to your source code?
 
Old 05-05-2011, 08:17 PM   #19
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by archie101 View Post
[/CODE] and the error is
Code:
gcc: error: c.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
do i have to take the .c off?

sorry for my knowing nothingness i am used to using a windows compiler.
Do you know the extremely basic concepts such as the current directory and relative paths (note that it's not really programming-related, but very important for doing anything in the command line)? If not, read this before continuing: http://linuxcommand.org/
 
Old 05-07-2011, 04:50 AM   #20
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
Well, this is speculation but it looks like there is a compiler but nothing to compile.
I would suggest going into the directory that has the c.c file and then executing gcc c.c. Else provide the full path name eg 'gcc /home/name/dir/c.c'.
Hope this helps.
 
Old 05-07-2011, 06:22 AM   #21
Nermal
Member
 
Registered: Jan 2009
Distribution: Debian
Posts: 59
Blog Entries: 2

Rep: Reputation: 6
Hi Archie101;

OK, your code, the content of "hello.c":
Code:
#include <stdio.h> /* include the headers that have printf in them */

int main(int argc, char *argv[]) /* correctly call the main function, yours would work but it will cause a warning when compiling */ 
{

printf("hello\n");  /* the \n puts a new line at the end */

return (0); /* as main has been defined as returning an int then we should really return something */

}
To compile make sure that hello.c is in the current directory:

Code:
bash$ gcc -o hello hello.c
This in the normal world would compile hello.c into an executable of hello

Now if it throwing errors on compile time then the problem is likely that it cannot find the libraries it needs.

Can you check that there is a file called "/usr/lib/libstdc++*" ?

also a quick explanation of how you installed gcc and the Linux version/distribution you are using would help.
 
Old 05-07-2011, 07:09 AM   #22
kindofabuzz
Member
 
Registered: Mar 2010
Location: There
Distribution: Linux Mint 17.1
Posts: 237

Rep: Reputation: 45
It's not finding it because you're not in the directory that's the c file is in. cd to that dir then run gcc again.
 
Old 05-07-2011, 09:06 AM   #23
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by Nermal View Post
Can you check that there is a file called "/usr/lib/libstdc++*" ?
How is that relavent? The OP is using C.
 
  


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
Can you build a C Compiler without an existing C compiler? (Chicken and the egg?) chutsu Linux - Software 6 12-14-2010 09:57 PM
checking for C compiler default output... configure: error: C compiler cannot create clubbing80s Linux - Software 3 07-05-2010 09:17 PM
checking for C compiler default output... configure: error: C compiler cannot create fiorejm Linux - Software 6 11-12-2009 01:35 PM
My c compiler doesn't work after the cross-compiler installed heracles.cn Linux - Newbie 1 06-05-2007 04:55 AM


All times are GMT -5. The time now is 09:41 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