Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-12-2009, 09:21 AM   #1
LQ Newbie
Registered: Jan 2009
Posts: 2

Rep: Reputation: 0

I am an absolute beginner in Linux environment. I have got Ubuntu8.10 loaded in my system. I know how to execute simple shell programs.
I want to compile and run c/c++ programs in this environment.
I am having gcc here. I tried whereis gcc at the shell and I got usr/bin/gcc

I do not want to tamper with the profile.
I want to set path to gcc just for this shell window.
Can you help please with exact steps to set path and compile a simple hello.cpp?

Thank you.
Old 01-12-2009, 09:25 AM   #2
Senior Member
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Open a terminal and type:
gcc hello.cpp
Old 01-13-2009, 09:20 AM   #3
LQ Newbie
Registered: Jan 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Hello Agrouf,
Thank you for the help. I tried again.
echo $PATHI got /usr/bin along with other folders.
So it is in default path.
Without any change, I was able to run perl and python programs.
But when I gave the command
gcc hello.cpp -o hello
I get error message .something like exccp file not found.

May I know where I have gone wrong?

Old 01-13-2009, 10:03 AM   #4
Senior Member
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
I need the exact error message
Old 01-13-2009, 10:34 AM   #5
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Do you have a file called "hello.cpp" in the directory in which you executed the gcc command?

The error message you (almost) posted above suggests that you don't have any source code to compile and link.

Have you considered installing one of the many IDE (Integrated Development Environment) packages? Any one of them should help you get started.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Add gcc to my path with vi bcaseytekah Linux - Newbie 6 01-12-2009 11:16 PM
yum install gcc doesn't set the lastest gcc ver 4.3.x kim,jw Linux - Newbie 3 12-23-2008 12:51 AM
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 01:24 AM
Gcc not found in the $PATH redrobin77 Linux - Software 3 01-12-2004 12:08 PM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 03:52 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:22 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration