Results 1 to 6 of 6

Thread: how to install c on ubuntu

  1. #1
    Join Date
    Dec 2010
    Posts
    79

    how to install c on ubuntu

    I had recently formatted my windows system and installed ubuntu on my computer. Generally I don’t use ubuntu but my friends says it’s a good operating system . I want to try this operating system and experience a change, but I’m facing problem while using this, the windows application and ubuntu application are different and they also execute, install in different way. I want to install c language in this operating system, but I don’t know how to install it. Please help me in installation, I need help.

  2. #2
    Join Date
    Mar 2009
    Posts
    1,360

    Re: how to install c on ubuntu

    If you want to install c on your ububtu than you need C compiler for your development work. In ubuntu you can install the build-essential for C compiler.
    Install C compiler in ubuntu:
    sudo aptitude install build-essential
    This will install all the required packages for C compiler
    Testing C and Programs
    Compiling Your first C Programs
    Now you need to open first.c file
    sudo gedit first.c
    add the following lines save and exit the file

    Firstly compile the code using the following command
    cc -c first.c
    that would produce an object file you may need to add to the library.
    then create an executable using the following command
    cc -o first first.c
    Now run this executable using the following command
    first c
    Output should show as follows
    Hello, world

  3. #3
    Join Date
    Nov 2008
    Posts
    1,259

    Re: how to install c on ubuntu

    If you are a ubuntu user and using intel compiler for c then require installing 32-bit libraries for Ubuntu if you are using a 64-bit system. Please ensure you have the packages:
    1.gcc, build-essential, libc6-dev (see above)
    2.ia32-libs, g++-multilib, and libc6-dev-i386 (for 64-bit systems)
    3.32-bit packages starting with lib32 (for 64-bit systems)
    4.alien and rpm for installing the RPM packages that Intel distributes.
    5.libstdc++5 and libstdc++5-3.3-dev for good measure because Intel's builds depend on these runtimes.
    Ensure that you have obtained the license number for your installation and extracted the downloaded installation archive into a path that does not contain any spaces. The installer script that comes with the package has a bug that does not allow you to install the compiler suite if you have any spaces in the installer script path. On 64-bit systems you may also need to issue these commands:
    # cd /usr/lib32
    # ln -s libpthread.so libpthread.so.0
    # ln -s libm.so libm.so.6
    # ln -s libc.so libc.so.6
    # ln -s libdl.so libdl.so.2
    because the chklic_32_64 license checking utility from Intel dynamically links to these libraries.once you have done, then its time to go to installer directory and install the compiler. If this does’nt work then search more on internet about this you will get the solution.

  4. #4
    Join Date
    Nov 2008
    Posts
    1,185

    Re: how to install c on ubuntu

    to run a c program on ubuntu you'll need to extract the files first.
    Code:
    tar -xzfv filename.tar.gz
    Then cd into the directory of the code.
    the usual procedure is:
    Code:
    ./configure
    make
    sudo make install
    sometimes there is no configure file and source uses autogen, you can usually find more info from the website you got the software from. If this things don’t work for you then try to search on internet on this topic.

  5. #5
    Join Date
    Nov 2008
    Posts
    1,221

    Re: how to install c on ubuntu

    You need a code to install the c on your ubuntu. The following code will work for you:
    sudo aptitude install build-essential
    this code will install nearly everything you need or in ubuntu or debian, your program name is Synaptic. Synaptic is a program for installing programs. contains list everyone programs, and you check program and installing.

    System-> Admin-> Synaptic.

    search a gcc, and check for install.

    other way to install, is a console. Open console and write this command.

    sudo aptitude install gcc

    this command install gcc in ubuntu.

  6. #6
    Join Date
    Nov 2008
    Posts
    1,022

    Re: how to install c on ubuntu

    You need to install build essential for C compiler for development work if you are a developer.
    just run following command in terminal and all the required packages for C compilers will be installed.
    sudo aptitude install build-essential
    Now you can test your first C program
    .Type following to open mytest.c file.
    sudo gedit mytest.c
    Add these lines and save the file.
    #include <stdio.h>
    int main()
    {
    printf(“Hello,World!\n”);
    }
    Compile the code by the following command
    cc -c mytest.c
    Type following to create an executable
    cc -o mytest mytest.c
    Now you can run it by this command
    ./mytest
    This will surely work for you.

Similar Threads

  1. how to install c++ on ubuntu
    By Ansari Bros in forum Operating Systems
    Replies: 6
    Last Post: 30-10-2011, 12:56 AM
  2. How to install XP after Ubuntu
    By AaAgMaN in forum Operating Systems
    Replies: 4
    Last Post: 30-01-2011, 07:39 PM
  3. how to install vb.net on ubuntu
    By Mustafa k in forum Operating Systems
    Replies: 5
    Last Post: 03-01-2011, 07:07 PM
  4. How to install JRE on Ubuntu
    By abbase in forum Operating Systems
    Replies: 4
    Last Post: 12-10-2009, 11:20 AM
  5. Install IE in Ubuntu
    By KDE_RuLeZ in forum Operating Systems
    Replies: 3
    Last Post: 31-08-2009, 07:34 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,829,774.00986 seconds with 17 queries