LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-06-2014, 08:23 PM   #1
arcolombo698
Member
 
Registered: Nov 2013
Posts: 31

Rep: Reputation: Disabled
Testing an executable


Hello.

I just untarred a source code of C++ files containing many .cpp, .outs and other header files.

Now in this file is the executable named SHINE

and I wish to test this executable. however when I type in the command line

SHINE

I get error "command not found".

So this means that the executable is not being called.

SO I added the directory to my environment variables

setenv PATH /auto/rcf-proj/sa1/software/SHINE_2.3.0e:${PATH}

and I get the same error.

So I am not sure how to test the executable.

I know that the files are just codes written in C++, and the algorithms are in C++ and I don't think it is a "program". So I am not sure that typing "SHINE" will bring up the commands... or man "SHINE" still fails.
 
Old 01-06-2014, 08:29 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,030
Blog Entries: 1

Rep: Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114
No need to set the path to test it.

Change to the directory where that file is and type:

Code:
ls -l SHINE
... to see if it is really executable.

If not then ...

Code:
chmod +x SHINE
Then to run it...

Code:
./SHINE
I have no idea what SHINE is nor what dependencies it may have, so if you get error messages post them back here if you don't know what they mean.

Since it is a directory of cpp files you will probably need to compile it first. Is there a file named configure or Makefile in that directory. Also if there is a README, be sure to do that!

Last edited by astrogeek; 01-06-2014 at 08:33 PM.
 
Old 01-06-2014, 08:50 PM   #3
arcolombo698
Member
 
Registered: Nov 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
make file

thank you in advance

Yes, the directory is all C++ files. so there are three types of file extensions .h, .o and .cpp.

There is one file that is just SHINE with no extension. I assume this to be the exec.

I had already changed the permissions.

I originally downloaded the directory and untarred it and typed "make", and it created all the files (.h, .o. .cpp .. etc)


Normally with other files I can just type "man program" and can test the install.

for this, because it is just a directory of c code.. i Just wish to test it.

if I type

./STAR

EXITING because of fatal input ERROR: could not open readInFile=Read1

Jan 06 17:47:55 ...... FATAL ERROR, exiting



so I 'm sure I have everything... i just need to specify the correct args.

ideas?
 
Old 01-06-2014, 09:07 PM   #4
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian
Posts: 1,054

Rep: Reputation: 276Reputation: 276Reputation: 276
SHINE is probably a text file, not a binary. It's easy enough to find out with
Code:
cat SHINE
. If you see text, it isn't a binary file. If you see random ASCII characters, it may be.

Linux does not search the current directory for executable files. If you want to run a script or binary in the current directory, preface the filename with ./, as in ./SHINE to force the shell to look in the current directory. Linux is not Windows, which looks in the current directory by default. Different operating systems, different philosophies.
 
Old 01-06-2014, 09:20 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,
Quote:
Originally Posted by arcolombo698 View Post
so I 'm sure I have everything... i just need to specify the correct args.

ideas?
If there is no documentation associated with this code, you should read the code itself. Start with the file containing the main function. You can probably find it with the following command:
Code:
grep main *.cpp
HTH,

Evo2.
 
Old 01-06-2014, 10:11 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,145

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Generic instructions:

Usually, an archive of source files will include a text file named README or perhaps INSTALL (or both) giving instructions for building and installing the package. Lacking those, I would look for an executable script called "configure" in the top directory. If that exists, running "./configure --help" should give a list of configurations options. Then, running "./configure" with whatever options you deem necessary (perhaps none) will examine your system and configure the source for building. Then, simply running "make" should build the program, and running "make install" will install the resulting program(s). That last step typically need to be done as root. None of the other steps should be done as root.
 
  


Reply


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
Testing Testing My Linux Counter rtrahan Linux - Newbie 3 02-23-2009 06:25 AM
Replace 'etch' with 'testing' in /etc/apt/sources.list to track 'testing' branch? Akhran Debian 3 04-09-2007 11:45 AM
Sarge-testing To Etch-testing? SMurf7 Debian 3 02-21-2006 11:59 PM
Running a Java executable class from another executable class LUB997 Programming 22 07-24-2005 05:57 AM
Setup as getting debian testing files from ftp - will it stay with testing BrianHenderson Debian 2 09-02-2004 07:06 PM


All times are GMT -5. The time now is 10:40 PM.

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