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 11-02-2011, 07:31 AM   #1
peter576
Member
 
Registered: Nov 2009
Distribution: Debian 8 (64bit)
Posts: 32

Rep: Reputation: 0
can't run executable files


Hello!
My problem is that I tried to compile a C++ file and it worked well, I compiled a HelloWorld.exe, HelloWorld.out, HelloWorld without extension and none of them can be executed, if I click on them nothing happens and I can't start them from terminal (maybe I should use a command to run them, I don't know)
And the code is:

#include <iostream>
using namespace std;

int main() {
cout << "Hello World \n";
cin.get();
cin.get();
return 0;
}

There was no error when compiling.
I'm using Ubuntu 11.10
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 11-02-2011, 07:55 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Because your program is using terminal I/O, you need to run it from a terminal (otherwise it has nowhere to send the output, and will hang waiting for input).

To run it from the terminal, you should invoke it with a preceding './', ie:
Code:
./HelloWorld.out
You cannot invoke it using only the name (since the default path does not include the current directory; this is done deliberately to prevent the accidental running of malicious programs).

Last edited by neonsignal; 11-02-2011 at 07:58 AM.
 
2 members found this post helpful.
Old 11-02-2011, 09:47 AM   #3
peter576
Member
 
Registered: Nov 2009
Distribution: Debian 8 (64bit)
Posts: 32

Original Poster
Rep: Reputation: 0
Thank you. It works
 
  


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
How to run executable files? Kelley Linux - Newbie 34 07-06-2017 10:31 PM
How to run executable files ? SeZen Linux - Newbie 28 11-06-2010 11:13 AM
[SOLVED] can not run executable files in slackware 13 seflyer Slackware 8 04-26-2010 06:01 PM
Cant't run executable files on Mandrake 9.1 alex101 Mandriva 4 10-14-2003 11:36 AM
run executable files ZeRo69er Linux - Software 4 08-07-2003 03:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:37 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