Jump to content

Problem with gcc [solved]


Guest Anna Ves
 Share

Recommended Posts

Guest Anna Ves

I have recently installed Ubuntu. It seems quite a good way of escaping from Windows for the first time. But I have a problem... The main reason for me installing a Linux-based operating system is because I want to practise my skills in programming using c language. But I cannot make gcc work from the command line of the terminal :( Do I have to install anything else?

Edited by Anna Ves
Link to comment
Share on other sites

i agree with your assesment of ubuntu. ubuntu seems very 'window-user desiring escape'-friendly. it's a good solid distribution.

 

1. are you sure you have it installed?

2. what happens when your just type 'gcc'? does it give you errors concerning whether you have made a proper call or not?

3. how do you call the compiler? is it similar to

 

gcc -o file.out file.c

 

(or g++ if you're compiling c++ code)?

 

4. if the compiler is being called and you're getting some other errors, perhaps it's in your c/c++ code.

 

either way, post your output errors here. the more information you provide us the more you'll intrigue us or increase the probability of someone knowing the solution immediately.

 

good luck!!

 

Jon

Link to comment
Share on other sites

Guest Anna Ves

I guess that gcc is not installed. Because when I try to compile a file the message I get is gcc: command not found.

 

Yes, I type gcc -o file.out file.c, and this is the error message I get.

 

Do I have to include a path in the .bashrc file in order for gcc to be inluded? (Because I have found a folder in my home directory that is called libs/gcc. I assume that this means that gcc exists in my system, wrong?)

 

Yes, I admit I am a bit (...a huge bit) inexperienced as far as linux is concerned...

If gcc is not installed, how can I install it? Download a gz file, unzip it and then? Does Linux work with setup files similar to those that windows use?

 

Thank you in advance. I might not see or understand things that are obvious for you, but it's just because of ignorance. I want to learn.

 

Thanks

:D

Link to comment
Share on other sites

Hi Anna,

 

Your posts seems pretty knowledgeable. Every one of us was hugely inexperienced at some point and time. The biggest things is that you're obviously very willing to learn and aren't embarassed to ask questions.

 

Enjoy,

 

Jon

Link to comment
Share on other sites

Guest Anna Ves

First of all thank you all for your support.

 

@Jon: Thank you for amking me feel so much at home

@shengchieh: I have already tried cygwin. It is a really good solution, but it's time for me to ecsape from window. Thank you very much though.

 

@paul:

sudo apt-get install gcc make build-essential

 

That should fix you up

 

Yes, that totally fixed me up! I now have gcc installed and working. But could you please explain to me how sudo command worked in this case? I'll try to "man" a few things and "google" a few other.... but I still have a long long way to go...

 

THANK YOU!!!!!

Link to comment
Share on other sites

sudo:

su = switch user

do = do :) .. duh!

 

so ...

sudo = switch user, then do (something) in this case apt-get install .....

sudo assumes you want to run something as root

 

 

 

edit:

in most cases sudo will require a password, the exception however is ubuntu.

They have built the OS around the use of sudo (and its counter parts .. gnome-su, kde-su etc etc)

 

it is basically a safe-ish way of allowing root access to your OS for a brief period of time.

 

This will not work on Mandriva, or gentoo, redhat, debian (the list goes on) with out further configuration .. its just the way ubuntu does things

Link to comment
Share on other sites

Build-essential is a metapackage which allow you to quickly getting the basic tools for compiling etc. The metapackage installs libc6-dev, gcc (v4:4), g++ (v4:4), make and dpkg-dev.

All the packages are on the CD but not installed by default.

 

You can also use aptitude instead of apt-get. The favor of using aptitude instead of apt-get is that aptitude is better to "solve" dependecy problems thean apt-get. Also if you install something with aptitude it can "remember" which extra libs/files/etc. that application/libs downloaded to make the it work.

 

Eg:

sudo aptitude install build-essential

 

now if you use apt-get to remove build-essential (sudo apt-get remove build-essential) it will only remove build-essential and not the dependeny that comes with it.

Instead use the aptitude to remove build-essential;

sudo aptitude remove build-essential

Aptitude will remove build-essential and its dependency (libc6-dev, gcc (v4:4), g++ (v4:4), make and dpkg-dev).

 

 

Off-topic:

Only 9 days to Ubuntu Edgy will be official released :Insert 100 of dancing bananas:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...