LinuxQuestions.org
Review your favorite Linux distribution.
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 08-25-2013, 02:02 PM   #1
IWishIKnew12
LQ Newbie
 
Registered: Aug 2013
Posts: 13

Rep: Reputation: Disabled
Question How to run a binary executable compiled in C++ on Linux?


Also, anyone know how to run a binary executable cmpiled in C++ on Linux? I can't get it to work from the terminal, it acts like I pressed enter with no commands... (I got Ncurses, G++, and created a shell command which I added to the Environment variable of the terminal I compile from) I could also not find any answers for this online.

Thanks for your time.

Last edited by unSpawn; 08-25-2013 at 03:02 PM. Reason: //Edit before move
 
Old 08-25-2013, 05:25 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,795

Rep: Reputation: 292Reputation: 292Reputation: 292
When you enter the command from a terminal what error message do you get?

------------------
Steve Stites
 
Old 08-25-2013, 05:27 PM   #3
IWishIKnew12
LQ Newbie
 
Registered: Aug 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
Code:
./myProgram
nothing...

I i do
Code:
bash ./myProgram
it says that it can't run binaries, though.

Otherwise it just does nothing, as if I pressed enter without typing in any command.

Last edited by IWishIKnew12; 08-25-2013 at 05:30 PM.
 
Old 08-25-2013, 06:47 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Do you expect the program to give any output? What is the return code from it (to find out do the following):

Code:
./myprogram
echo $?
If you do:

Code:
strace ./myprogram
do you see it executing any system calls?
 
Old 08-25-2013, 07:51 PM   #5
IWishIKnew12
LQ Newbie
 
Registered: Aug 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
Tracing it definitly shows that the program is doing somthing, but when I execute it, (REPEATING WHAT I SAID IN ALL OF MY OTHER PREVIOUS POSTS) it does nothing. It cts as though I typed nothing in, and pressed enter.

Yes, I expect the program to do somthing. It is supposed to display a message and wait until any key is pressed and exit. It is a test program.

Last edited by IWishIKnew12; 08-25-2013 at 07:53 PM. Reason: add...
 
Old 08-25-2013, 07:55 PM   #6
IWishIKnew12
LQ Newbie
 
Registered: Aug 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
test: bash

Quote:
bash ./program
./program: ./program: cannot execute binary file
There you go, are you convinced yet?

Also, the return code is 0.

Last edited by IWishIKnew12; 08-25-2013 at 07:58 PM. Reason: return code addition
 
Old 08-25-2013, 08:00 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,033
Blog Entries: 1

Rep: Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119
Quote:
Originally Posted by IWishIKnew12 View Post
Tracing it definitly shows that the program is doing somthing, but when I execute it, (REPEATING WHAT I SAID IN ALL OF MY OTHER PREVIOUS POSTS) it does nothing. It cts as though I typed nothing in, and pressed enter.

Yes, I expect the program to do somthing. It is supposed to display a message and wait until any key is pressed and exit. It is a test program.
Then you probably have a bug in the program that causes it to not act as you expect.

Is the source code short enough to post here?
 
Old 08-26-2013, 12:17 AM   #8
IWishIKnew12
LQ Newbie
 
Registered: Aug 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
Well crap... big mistake I made...

I forgot to call the function in main, so when it executed, it just returned 0... Big woopsee... er, sorry... (0,o)

In any case, it works now. I guess I just need to get used to sublime.
 
  


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
Why I cannot run the compiled executable in other pc? christyyim Linux - Newbie 5 12-23-2008 04:18 AM
Converting Torrent to Linux Executable Binary btbx Linux - Software 2 06-28-2008 01:07 PM
version GLIBC_2.3 not found error when cross compiled executable is run on targert sateeshgalla Programming 3 05-14-2008 11:42 AM
Run executable file compiled by kylix and mysql in Fedora Core 4 aa_husni Fedora 0 09-15-2005 01:14 AM
Executable compiled w/gcc won't run brancheb Programming 5 05-16-2004 02:56 PM


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

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