Thread: How To Run C Programs In Ubuntu?

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    9

    Question How To Run C Programs In Ubuntu?

    I am using code::blocks Compiler.
    If I Run Any Program From Codeblocks Xterm Showing Following -

    "sh: 1 : /home/username/Desktop/cp: Permission Denied"

    How Can I Run Any Program On Ubuntu?
    I Am Using Ubuntu Quantal.

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    505
    Quote Originally Posted by Ashfaqur Rahman View Post
    I am using code::blocks Compiler.
    If I Run Any Program From Codeblocks Xterm Showing Following -

    "sh: 1 : /home/username/Desktop/cp: Permission Denied"

    How Can I Run Any Program On Ubuntu?
    I Am Using Ubuntu Quantal.
    create a file with the following

    Code:
    #include <stdio.h>
    
    int main(void)
    {
      printf("Hello world\n");
      return 0;
    }
    save it as hello.c, then type gcc hello.c. gcc should create a file called a.out. When you type ./a.out, it should run the program.

    If any of these steps don't work, you don't have permissions set up normally, and you'll have to log in as super user (sudo) to fix things.
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.
    https://github.com/MalcolmMcLean


  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    1. Can you run it from the command line?
    Code:
    ./programname
    2. Do you have CB configured correctly for terminal settings?
    I have no idea of the correct way.

    2b. Whatever terminal program you told Code::Blocks to use;
    Is it installed on your system?


    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CGAL in Ubuntu 12.04
    By anirban in forum Tech Board
    Replies: 10
    Last Post: 07-25-2012, 09:52 AM
  2. Something other than Ubuntu
    By Annonymous in forum Tech Board
    Replies: 16
    Last Post: 10-24-2011, 06:07 PM
  3. Ubuntu
    By GReaper in forum Tech Board
    Replies: 8
    Last Post: 09-06-2010, 10:46 PM
  4. Replies: 1
    Last Post: 11-09-2009, 07:03 AM
  5. 32 bit to 64 bit Ubuntu
    By Akkernight in forum Tech Board
    Replies: 15
    Last Post: 11-17-2008, 03:14 AM

Tags for this Thread