Fedora Linux Support Community & Resources Center
Sections ›› Home | Forums | Guidelines | Forum Help | Fedora FAQ | Fedora News 

Go Back   FedoraForum.org > The Community Lounge > Programming

Programming A place to discuss programming and development

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 2009-10-29, 10:09 AM CDT
CD-RW Offline
Registered User
 
Join Date: Nov 2006
Posts: 409
linuxfedorafirefox
Interactive C/C++ interpreter on Fedora?

Is there a C/C++ interpreter similar to PHP, Python, Ruby etc, that I can use to run C programs a line at a time, without compiling the C code?

Does Fedora 8+ come with anything like this in the repos?

TIA
Reply With Quote
  #2  
Old 2009-10-29, 12:13 PM CDT
pete_1967 Offline
Clueless in a Cuckooland
 
Join Date: Mar 2006
Posts: 2,733
linuxfedorafirefox
Because C and C++ are compiled languages unlike PHP etc, not really. What you can do is to run the code in a debugger, GDB for example, to see what happens, where and when.
__________________

F9 x86_64
Lian-Li SILVER CLASSICAL SERIES
MSI K9N2 Diamond
AMD Phenom 9850 BE
XFX GeForce 8800 GT Alpha Dog 512MB GDDR3 HDTV/Dual DVI
8 GB Corsair DDR2 800MHz/PC2-6400 XMS2 DHX
2x Seagate Barracuda 7200.10 320GB S300 RAID 1
Philips Brilliance 200W 20.1"
Reply With Quote
  #3  
Old 2009-10-29, 12:55 PM CDT
Simian Man's Avatar
Simian Man Online
Registered User
 
Join Date: Sep 2008
Location: Tallahassee
Age: 25
Posts: 208
linuxfedorafirefox
There is one called Ch that interprets C, but it doesn't support C++ IIRC. It's not really the best idea in my opinion though. If you are doing something where compiling a program is annoying, having to use C at all will be *way* more annoying.

What are you actually trying to do?
Reply With Quote
  #4  
Old 2009-10-29, 09:29 PM CDT
aleph's Avatar
aleph Offline
Registered User
 
Join Date: Jul 2007
Location: Beijing, China
Posts: 860
linuxfedorafirefox
Maybe he just wants to learn about C but don't want to go over the make - run - break - edit - make stuff over and over again. Being able to see the disastrous results at once is sometimes considered a virtue. run - break - run - break - run - break - run - win.
__________________
Those who can, do. Those who can't, loop.
Reply With Quote
  #5  
Old 2009-10-30, 08:43 AM CDT
CD-RW Offline
Registered User
 
Join Date: Nov 2006
Posts: 409
linuxfedorafirefox
Thumbs up

Quote:
Originally Posted by Simian Man View Post
There is one called Ch that interprets C, but it doesn't support C++ IIRC. It's not really the best idea in my opinion though. If you are doing something where compiling a program is annoying, having to use C at all will be *way* more annoying.

What are you actually trying to do?
All I want to do is to run small examples of C code in an interpreted environment, to save doing the compile, link and run stuff.

I've seen the Ch website. There is also this one here:

Cint: http://root.cern.ch/drupal/content/cint


I was wondering if they or something similar was packaged for Fedora 8+?

Save me the trouble of compiling and messing with the source code.

Note: I'm using Eclipse and CDT for compiling and debugging C/C++ code, which is brilliant. However, it seems overkill to start Eclipse, and create a project just to test a few lines of C code.

Last edited by CD-RW; 2009-10-30 at 08:46 AM CDT.
Reply With Quote
  #6  
Old 2009-10-30, 06:23 PM CDT
marko's Avatar
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 2,731
linuxfedorafirefox
Quote:
Originally Posted by CD-RW View Post
However, it seems overkill to start Eclipse, and create a project just to test a few lines of C code.
Yeah, that's what this is good for:
Code:
g++ test.cpp -o test

./test
__________________
Mark in Laurel, MD USA Intel Q6600 ; Sony Vaio SZ730
Reply With Quote
  #7  
Old 2009-10-30, 06:32 PM CDT
Firewing1's Avatar
Firewing1 Online
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 18
Posts: 9,027
macossafari
If you want, you can alias these commands which do roughly what you would expect from an interpreter:
Code:
cat > tobeinterpreted.cpp << EOF && gcc tobeinterpreted.cpp -o tobeinterpreted && ./tobeinterpreted;rm tobeinterpreted.cpp
Just start typing the file and put "EOF" on its own line to exit editing mode and start compiling.
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #8  
Old 2009-10-30, 06:54 PM CDT
aleph's Avatar
aleph Offline
Registered User
 
Join Date: Jul 2007
Location: Beijing, China
Posts: 860
linuxfedorafirefox
I don't believe that's what the OP wanted. Not interactively enough.
__________________
Those who can, do. Those who can't, loop.
Reply With Quote
  #9  
Old 2009-10-30, 07:00 PM CDT
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 303
linuxfedorafirefox
I just use three windows - one for edits, one for compile, one for execute/debug.

That way any compile errors (with line numbers) are immediately accessible, and can be correlated with the
source.
Reply With Quote
  #10  
Old 2009-10-30, 07:19 PM CDT
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 2,598
linuxfirefox
Quote:
Originally Posted by CD-RW View Post
There is also this one here:

Cint: http://root.cern.ch/drupal/content/cint
Cool, I never knew there was such a thing. This is helpful. I use something similar for Java.
Reply With Quote
  #11  
Old 2009-11-03, 02:08 PM CST
CD-RW Offline
Registered User
 
Join Date: Nov 2006
Posts: 409
linuxkonqueror
Here's the homepage for Ch:

http://www.softintegration.com/

Ch is an embeddable C/C++ interpreter for cross-platform scripting, shell programming, 2D/3D plotting, numerical computing, and embedded scripting. Ch is a free and user-friendly alternative to C/C++ compilers for beginners to learn C/C++. Ch is the solution for:

* Embedded Scripting
* Enterprise
* Academic
* Numerical Computing
* Web-Based Computing

Nice to have this or CINT packaged with Fedora

Both would be even better - LOL
Reply With Quote
Reply

Tags
c/c++, interactive, interpreter

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Interpreter in Fedora 11 k_oudom Installation Help 13 2009-07-10 08:20 AM CDT
Fedora 8 and freetype bytecode interpreter Toccata Software 21 2008-12-11 01:11 PM CST
Fedora 9 x86-64 will not boot into interactive install, goes to localhost arbeiter x86 64-bit 1 2008-11-01 01:47 AM CDT
/bin/bash^M bad Interpreter: gold General Support 2 2007-09-03 02:27 AM CDT
Perl Interpreter Druid Software 4 2005-04-14 08:39 AM CDT

Automatic Translations (Powered by Powered by Google):
Afrikaans Albanian Arabic Belarusian Bulgarian Catalan Chinese Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician German Greek Hebrew Hindi Hungarian Icelandic Indonesian Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Taiwanese Thai Turkish Ukrainian Vietnamese Yiddish

All times are GMT -7. The time now is 08:46 AM CST.

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
Hosting provided by ThePlanet



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 | Founding Members
Designed By Ewdison Then | Powered by vBulletin ©2000-2009, Jelsoft Enterprises Ltd.
FedoraForum is Powered by Open Source Projects and Products
Thanks to NLP-er you enjoy automatic translations (vBET)