cojoe
cojoe

Reputation: 45

Execute C++ program from command prompt

I created a program in Eclipse and the only way it runs is from a console application like command prompt in Windows or a Unix terminal. I am using a windows OS so I want to know how to execute the program from command prompt, and from a unix terminal too?

Upvotes: 0

Views: 313

Answers (2)

itproxti
itproxti

Reputation: 51

On Unix g++ <file-path> Example(from home directory) g++ ././C++/E1-13.c To run it ././C++/a.out Example(within directory) g++ E1-13.c To run it ./a.out

Note: you can use other file extensions such as .cc, .cpp, etc.

Upvotes: 1

Shane Duffy
Shane Duffy

Reputation: 1147

Check the documentation for the "start" command.

C:\>start /?
Starts a separate window to run a specified program or command.

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
  [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
  [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]
  [command/program] [parameters]

"title"     Title to display in window title bar.
path        Starting directory.
B           Start application without creating a new window. The
            application has ^C handling ignored. Unless the application
            enables ^C processing, ^Break is the only way to interrupt
            the application.

Upvotes: 2

Related Questions