Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 24th, 2006, 11:58 AM   #1
verb1426
Newbie
 
Join Date: Aug 2005
Posts: 26
Rep Power: 0 verb1426 is on a distinguished road
Question How to compile C++ code in GNU/Linux OS ?

Hi guys

I have always heard about GNU/Linux operating system and its advantages.So I reacently installed it.The problem is with compiling the c++ code using the command prompet.I am new to this OS and I have read that if I want to compile c++ code,I should save it in C file format and then browse to it through the shell ( or whatever its name is) then type:

gcc ****.c (**** indicate the file name)

but I keep receiving a maessage stating that the file was not found ,although I am 100% sure that it there (using dir command)

What is the problem?

Thank you all....
Verb1426
__________________
www.islam.ws
verb1426 is offline   Reply With Quote
Old Feb 24th, 2006, 12:04 PM   #2
Kaja Fumei
Hobbyist Programmer
 
Join Date: Oct 2005
Posts: 134
Rep Power: 3 Kaja Fumei is on a distinguished road
Read this: http://www.cs.wm.edu/cspages/computi...orial/gpp.html
Kaja Fumei is offline   Reply With Quote
Old Feb 24th, 2006, 2:19 PM   #3
verb1426
Newbie
 
Join Date: Aug 2005
Posts: 26
Rep Power: 0 verb1426 is on a distinguished road
Thank you very much ,but isn't this different from the command gcc ?
The tutorial shows another command which is g++ .
Moreover , I am still receiving the smae message.
__________________
www.islam.ws
verb1426 is offline   Reply With Quote
Old Feb 24th, 2006, 2:22 PM   #4
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
gcc ./filename.c
gcc ./filename.cpp

notice the ./ make sure you include it.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Feb 24th, 2006, 2:24 PM   #5
Cipher
Hobbyist Programmer
 
Cipher's Avatar
 
Join Date: Feb 2005
Location: /home/cipher
Posts: 123
Rep Power: 4 Cipher is on a distinguished road
Send a message via AIM to Cipher Send a message via MSN to Cipher
gcc -x c++ filename.cpp

-The "-x" option with c++ after it specifies the language.

or

g++ filename.cpp

-You can also use g++ to compile c++ code.

If you're using C code, then just do this:

gcc filename.c
__________________
And there was much rejoicing... Yay....
Cipher is offline   Reply With Quote
Old Feb 26th, 2006, 12:19 PM   #6
verb1426
Newbie
 
Join Date: Aug 2005
Posts: 26
Rep Power: 0 verb1426 is on a distinguished road
Thumbs up

Thank you .....it worked ,but not like A dream due to my bad program :o
Thank you all.
Verb1426
__________________
www.islam.ws
verb1426 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:38 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC