Fedora Linux Support Community & Resources Center
  #1  
Old 21st December 2008, 11:32 PM
Bill99 Offline
Registered User
 
Join Date: Nov 2008
Posts: 4
Angry Terminal Compiler doesnt function (Core 10)

I have a text file that when i open it it says that its an executable file (its c++ code so it should be)and it gives me some options, if i pick "run in terminal" the terminal window opens and then closes right away (if i pick "run" nothing happens). I know its not just the program running its course because the program requires user input to complete. I also know the program should work as it does work on my win xp comp running borland 5.5.

Im running fedora 10, and im a complete noob to linux. Im also not a very experienced programmer but like i said the program works on my other machine.
Reply With Quote
  #2  
Old 21st December 2008, 11:53 PM
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,832
Whaaaa !!! C++ *SOURCE* code is NOT executable and SHOULD NOT be set as executable according to the file system.

Many Windows based dumass utilities like to make source code executable.
It's a *big* F'ing mistake -
It's an error -
You are fortunate that it only exits immediately instead of wiping your files out.
==

1/ Set and c++ source files to NON-executable like this:
chmod -x foo.c++

2/ If you want to compile C++ source into an executable *binary* try the
g++ command. Then set the launcher to run the BINARY.

3/ "Run in terminal" is used for programs or scripts that require terminal interaction.
For example if you want to run "bc" or "grep" which are non-GUI tools, then the
script should have a launcher that uses the "run in terminal" option.

4/Example
[root@nidula ~]# cat >yo.cc
#include <iostream>
int main() { std::cout << "Yello, cruel world\n"; return 0; }
[root@nidula ~]# g++ yo ./yo.cc
[root@nidula ~]# ./yo
Yello, cruel world

Then put that ("/root/yo") in a "run in terminal" launcher.
as a test case.

Last edited by stevea; 22nd December 2008 at 12:10 AM.
Reply With Quote
  #3  
Old 26th December 2008, 09:12 PM
Bill99 Offline
Registered User
 
Join Date: Nov 2008
Posts: 4
I did what you said and it created yo.cc However i cant run it because it says it belongs to "root" not me, which is asinine because i am the only user of the system... so if you could tell me how to turn off all these permission issues that would be swell, im tired of trying to access things and haveing it say that i cant even though i am the one who created it and am the only one using the computer...
Reply With Quote
  #4  
Old 26th December 2008, 09:28 PM
JohnVV Offline
Registered User
 
Join Date: Aug 2005
Location: Ann Arbor
Age: 47
Posts: 3,936
if the file IS A SAFE ONE,AND I DO MEAN A SAFE file for you to run ( ie YOU WROTE it)
then do this because it is not a c source file but a shell script
open the terminal and do this
Code:
cd /to where/the/file/is
sh ./FileName
for example i have a nice script to cut a 32,768x16384 pixel image into a gruop of 512x512 px tiles
and it is in the system path so i do this
Code:
cd /usr/opt/PlanetMaps/Moon/Clem_NIR_V0.1
v_vt moon.v 512 png
the program name is "v_vt " fallowed by the options

Quote:
I have a text file that when i open it it says that its an executable file (its c++ code so it should be)and...
WHAT is the file, i am assuming you did not wright it ?
Were did you get it ?
and what is it supposed ti do ?
post the code or a link to the file
Quote:
I also know the program should work as it does work on my win xp comp running borland 5.5.
so is this a bit of MS Windows code you want to build on a linux box ?
this may be easy or imposable without a FULL rewright
post the code
to build a single c file program
Code:
gcc -o file file.c
g++ -o file file.cpp
__________________
OpenSUSE 13.1-64bit & Scientific Linux 6.5-64bit ( fedora 4 to 11) and 19/20 on KVM
My Celestia Downloads

h t t p ://celestiamotherlode.net/catalog/show_creator_details.php?creator_id=10

Last edited by JohnVV; 26th December 2008 at 09:35 PM.
Reply With Quote
  #5  
Old 26th December 2008, 11:51 PM
pete_1967 Offline
Clueless in a Cuckooland
 
Join Date: Mar 2006
Location: Here now, elsewhere tomorrow.
Posts: 4,315
Quote:
Originally Posted by Bill99 View Post
I also know the program should work as it does work on my win xp comp running borland 5.5.

Im running fedora 10, and im a complete noob to linux. Im also not a very experienced programmer but like i said the program works on my other machine.
You can't run a program compiled for one architecture and OS on a different platform or architecture.

Additionally, you say it is Borland C++, unless it's very, very simple one, it won't run on any system without Borland compiler meaning that you'll have to re-write it to ANSI if you want to run it on multiple platforms.

Either way, you need to compile the source for each OS/ architecture before you can run it. On Linux, the default and de-facto compiler is GCC, but you can install any other compiler to your liking (I think even Borland has Linux version of their compiler).
__________________
A Drink is Not Just For Christmas - SaskyCom :thumb:


“Give a man a fish; you have fed him for today. Teach a man to fish; and you have fed him for a lifetime” so now go and...
RTFM FIRST: http://docs.fedoraproject.org/ & http://rute.2038bug.com/index.html.gz
Reply With Quote
  #6  
Old 27th December 2008, 10:56 AM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,075
Quote:
Originally Posted by Bill99 View Post
I did what you said and it created yo.cc However i cant run it because it says it belongs to "root" not me
You should have created the file using your normal user account, not as root. There's no reason to edit/compile software as root.
Reply With Quote
  #7  
Old 27th December 2008, 05:46 PM
JohnVV Offline
Registered User
 
Join Date: Aug 2005
Location: Ann Arbor
Age: 47
Posts: 3,936
google/linux " gcc tutorial"
http://www.google.com/linux
http://www.google.com/linux?q=gcc+tu...rch&hl=en&sa=2
http://cs.acadiau.ca/~jdiamond/comp2...torialGcc.html
http://www.yolinux.com/TUTORIALS/LinuxTutorialC++.html
__________________
OpenSUSE 13.1-64bit & Scientific Linux 6.5-64bit ( fedora 4 to 11) and 19/20 on KVM
My Celestia Downloads

h t t p ://celestiamotherlode.net/catalog/show_creator_details.php?creator_id=10
Reply With Quote
Reply

Tags
compiler, core, function, terminal

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
Why Fedora Core project is using raw version of a compiler by default? cheer Programming & Packaging 7 1st March 2006 05:49 PM
Fedora 3 core doesnt boot anymore hansds Installation, Upgrades and Live Media 2 1st September 2005 08:24 AM
Fedora Core 3 Java Compiler? darkcast66 Programming & Packaging 2 2nd August 2005 06:44 PM
Remapping Function keys in core 3 haplo Using Fedora 1 11th March 2005 04:57 AM


Current GMT-time: 21:44 (Thursday, 18-09-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