Fedora Linux Support Community & Resources Center
  #1  
Old 8th September 2009, 04:47 PM
pradeep.rawat Offline
Registered User
 
Join Date: Sep 2009
Posts: 5
linuxfedorafirefox
C++ compiler in fedora 11

hi friend
i want to compile my c++ programe
i have installed fedora 11
and don't know how to do this
please help
Reply With Quote
  #2  
Old 8th September 2009, 05:04 PM
EmbeddedTwix Offline
Registered User
 
Join Date: Aug 2009
Location: Switzerland
Posts: 14
linuxfedorafirefox
Hi prad..,

Use Eclipe IDE and create a projet. Insert your file in the project and you will be able to it all using Eclipse.
If you don't have that package installed used System.Admin.Add/remove programs and look for Eclipe IDE.

I have done it few week ago and I work not to bad.

Good luck,

RL
Reply With Quote
  #3  
Old 8th September 2009, 11:31 PM
roelj Offline
Registered User
 
Join Date: Jun 2009
Location: Netherlands
Age: 23
Posts: 289
linuxfedorafirefox
All you need is the package "gcc-c++" (yum install gcc-c++).
And then compile using: g++ [sourcefile.cpp] -o [progname]

EmbeddedTwix , Eclipse is a good IDE, but it is not needed to compile C++ code.

Good luck!
Reply With Quote
  #4  
Old 18th September 2009, 12:32 PM
pradeep.rawat Offline
Registered User
 
Join Date: Sep 2009
Posts: 5
linuxfedorafirefox
Good reply but

thank for reply but tell step-by-step instruction to compile my c++ programme i installed gcc but don't know how to use it. thanks
ok ok ok i am getting errer message which is
file.cpp:3: error: ‘::main’ must return ‘int’


OOOOO yes thanks. i successfully compiled my programme but not able to run the compiled programme.
i am working on it. thanks again

ok tell me how compiled programme can run.

Last edited by pradeep.rawat; 18th September 2009 at 01:00 PM.
Reply With Quote
  #5  
Old 18th September 2009, 12:59 PM
pradeep.rawat Offline
Registered User
 
Join Date: Sep 2009
Posts: 5
linuxfedorafirefox
OOOOO yes thanks. i successfully compiled my programme but not able to run the compiled programme.
i am working on it. thanks again
Reply With Quote
  #6  
Old 18th September 2009, 02:44 PM
EmbeddedTwix Offline
Registered User
 
Join Date: Aug 2009
Location: Switzerland
Posts: 14
linuxfedorafirefox
Hi pradeep.rawat,

Check that you actually doing a compile and link.
The linked program generated is a executable file with same name as your main file or some basic name like 'out'.

example:
toto.cpp -> either generates: 'out' or 'toto'
In very simple cases, if it compiles and link without errors, you should see an executable file appearing in the same directory.
Ex.: If the file name is toto open a console window and type ./toto.
If your program is an 'hello world' like (using console outputs), you will get output at your console.

If this doesn't help say more about the command you are using and the current outputs you get.

Regards,
RL

Last edited by EmbeddedTwix; 18th September 2009 at 02:49 PM. Reason: Typo.
Reply With Quote
  #7  
Old 19th September 2009, 07:16 AM
Apple Offline
Registered User
 
Join Date: Sep 2009
Posts: 16
macossafari
You can also edit ~/.bash_profile by typing in "vi ~/.bash_profile" and change "PATH=$PATH:$HOME/bin" to "PATH=.:$PATH". This how I have mine setup so I can simply type the name of the compiled program and it runs, with out the "./" before it. So, if i compiled my app without the "-o" output it give me a file called "a.out" All I would have to do is cd into it's directory and type "a.out". I prefer it simply because it is faster when I'm testing my code for logic errors.

Hope this helps,
Alex
Reply With Quote
  #8  
Old 19th September 2009, 08:27 AM
pradeep.rawat Offline
Registered User
 
Join Date: Sep 2009
Posts: 5
linuxfedorafirefox
thank you very much friend

thank you very much friend


EmbeddedTwix
and
apple
Reply With Quote
Reply

Tags
compiler, fedora

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiler Option GCC, Intel Compiler, PathScale mounterriver Using Fedora 2 8th November 2009 02:31 PM
Fedora 10 compiler Paul77 Using Fedora 8 8th June 2009 03:17 PM
F77 compiler in Fedora 8 qsdd Programming & Packaging 1 6th March 2008 05:44 PM
C++ Compiler for fedora 8 mat.hunt Programming & Packaging 6 10th December 2007 08:11 PM
Tiny CC compiler with Fedora 5 rclark Programming & Packaging 0 7th September 2006 05:49 AM


Current GMT-time: 19:14 (Wednesday, 30-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat