Author |
Message |
TheMadScientist_2053
Joined: 17 Jun 2013 Posts: 8
|
Posted: Mon 01 Jul 2013, 00:35 Post subject:
Running c++ programs |
|
Okay so I just started running puppy on my tower and I am trying to figure it out. I have about 13 minutes of experience with all Linux distros, and am not very familiar with the terminal. I've downloaded the Devx.sfs and got that set up so at least I can compile whatever I write in Geany. The trick now is to actually run the darn thing. Most of the information I've found has to do with compiling and the Devx.sfs. Any and all help on the subject would be greatly appreciated.
|
Back to top
|
|
 |
amigo
Joined: 02 Apr 2007 Posts: 2641
|
Posted: Mon 01 Jul 2013, 06:06 Post subject:
|
|
Once compiling is done, you must make sure the binary object is set 'executable'. Then, from the shell in a terminal you execute it like this:
Code: | [path-to]program-name | [/quote]
|
Back to top
|
|
 |
TheMadScientist_2053
Joined: 17 Jun 2013 Posts: 8
|
Posted: Mon 01 Jul 2013, 12:10 Post subject:
|
|
amigo wrote: | Once compiling is done, you must make sure the binary object is set 'executable'. Then, from the shell in a terminal you execute it like this:
Code: | [path-to]program-name |
| [/quote]
How does one set the binary object to executable?
|
Back to top
|
|
 |
amigo
Joined: 02 Apr 2007 Posts: 2641
|
Posted: Mon 01 Jul 2013, 14:16 Post subject:
|
|
From the terminal:
chmod 755 name-of-file
The linker may do this properly for you, but it doesn't hurt to run the command anyway.
If you are running a terminal in the same directory where the binary executable is located, then simply:
Code: | chmod 755 file-name
./file-name |
In order to run the program without specifying the path to it, you need to place it in your PATH -usually under /usr/local/bin for stuff you compile yourself. Then, it can be run from a terminal anywhere or from a script, without giving the path:
|
Back to top
|
|
 |
6502coder

Joined: 23 Mar 2009 Posts: 446 Location: Western United States
|
Posted: Mon 01 Jul 2013, 14:24 Post subject:
how to make it executable |
|
cd to the place where the binary is located, then
Code: | chmod +x program-name |
BTW, if you tell us more about what you DO know, we can give you better help. You say you're not familiar with the terminal...Do you have any experience at all with using a command line, e.g. MS DOS or the command shell in Windows? Have you ever written and compiled a C++ program using either a command line or an IDE?
|
Back to top
|
|
 |
TheMadScientist_2053
Joined: 17 Jun 2013 Posts: 8
|
Posted: Mon 01 Jul 2013, 15:12 Post subject:
Re: how to make it executable |
|
6502coder wrote: | cd to the place where the binary is located, then
Code: | chmod +x program-name |
BTW, if you tell us more about what you DO know, we can give you better help. You say you're not familiar with the terminal...Do you have any experience at all with using a command line, e.g. MS DOS or the command shell in Windows? Have you ever written and compiled a C++ program using either a command line or an IDE? |
ipconfig is about the extent of my knowledge of windows command shell. As far as C++ goes, I'm pretty familiar with it. I've done quite a bit of stuff using the MicroSoft Visual studios IDE.
|
Back to top
|
|
 |
ericsond
Joined: 13 Apr 2013 Posts: 5
|
Posted: Wed 24 Jul 2013, 20:30 Post subject:
|
|
If you are planning to use Geany, this is even easier...for example just type (or cut and paste) a sample program like (assuming you have devx already installed):
#include <stdio.h>
int main( void )
{
printf("Hello World!");
return 0;
}
then you can go under the 'Build' drop down menu of Geany, and select Build, and then Execute, or even easier just do F9 and F5. You can even change what these do by using the 'Set Build Commands' under the 'Build' drop down menu.
|
Back to top
|
|
 |
|