LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-03-2011, 02:56 AM   #1
Nabeel
Member
 
Registered: Nov 2009
Location: Pakistan
Distribution: Ubuntu
Posts: 294

Rep: Reputation: 17
Question Error Running a program in C


Ok I wrote This program under C in a gedit text pad and then saved it with the .c extension. Now When i Tried to run it using the terminal I got this error. Does anyone knows what I am missing here.

Here is the error
Quote:
nabeel@nabeel-laptop:~/Desktop$ sh m.c
m.c: 1: /*Calculation: not found
m.c: 2: /bin: Permission denied
m.c: 4: Syntax error: "(" unexpected
nabeel@nabeel-laptop:~/Desktop$
Regards
 
Old 07-03-2011, 03:04 AM   #2
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 515

Rep: Reputation: 234Reputation: 234Reputation: 234
Well... C is a compiled language, sh (bash) is your shell, and it's an interpreter for shell scripts.

You need to use a compiler with your C program, usually gcc. Bash doesn't understand C code, only shell scripts.

I recommend you to get a good C book to sort out the basics first.

----

Just found your thread about learning the C language. Read the post by MTK358, there you'll find a very good and concise explanation that will help you compile your program.

Last edited by Diantre; 07-03-2011 at 03:27 AM.
 
  


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
Error preventing me running an online PhP scripted program Nickalf Linux - Server 1 02-21-2009 12:46 PM
Error while running C++ program smartgupta Programming 2 10-08-2008 01:54 AM
HELP:Error running program which includes system call stefio Programming 2 07-27-2008 10:37 AM
Running program from terminal with & does nothing, program stops DittoAlex Linux - General 1 10-05-2007 01:35 AM
Error running a C program, glibc detected *** free(): invalid next size (normal) mesh2005 Programming 3 11-08-2006 01:52 PM

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

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