Like Tree1Likes
  • 1 Post By Malcolm McLean

How To Run C Programs In Ubuntu?

This is a discussion on How To Run C Programs In Ubuntu? within the C Programming forums, part of the General Programming Boards category; I am using code::blocks Compiler. If I Run Any Program From Codeblocks Xterm Showing Following - "sh: 1 : /home/username/Desktop/cp: ...

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

    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
    333
    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.
    stahta01 likes this.
    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.
    http://www.malcolmmclean.site11.com/www

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    2,493
    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.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

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, 06:03 AM
  5. 32 bit to 64 bit Ubuntu
    By Akkernight in forum Tech Board
    Replies: 15
    Last Post: 11-17-2008, 02:14 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21