Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to run automatically compiled .exe in external console (cmd.exe)
How to run automatically compiled .exe in external console (cmd.exe) [message #1517699] Fri, 19 December 2014 17:44 Go to next message
Al Go is currently offline Al GoFriend
Messages: 4
Registered: December 2014
Junior Member
Is there a way to run compiled program inside Eclipse on Windows, but not in Eclipse internal terminal, but rather in new cmd.exe window? Some Run configuration or External Tools configuration?
Just like in QT, when you run compiled console application.
icon12.gif  Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1521250 is a reply to message #1517699] Sun, 21 December 2014 18:05 Go to previous messageGo to next message
Klaus km is currently offline Klaus kmFriend
Messages: 142
Registered: November 2011
Senior Member
Quote:
Some Run configuration or External Tools configuration?


Yes, edit the Run Configuration:

On the Main page set C/C++ Application to:
${system_path:cmd.exe}


On the Arguments page add (adjust path and program name):
/C "start .\Debug\hello.exe"


On the Common page untick "Allocate console".


In the example above the console windows will close immediately if hello.exe ends. If you don't want that, use this version on the Arguments page:

/C "start ${system_path:cmd.exe} /K .\Debug\hello.exe"


Btw, you could use the same concept for External Tools configuration also!

regards,
Klaus


Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1522564 is a reply to message #1521250] Mon, 22 December 2014 11:44 Go to previous messageGo to next message
Al Go is currently offline Al GoFriend
Messages: 4
Registered: December 2014
Junior Member
Thanks a lot, that what I did want.
By the way, where can I find description of Arguments (/C, /K.. etc.)?
Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1522579 is a reply to message #1522564] Mon, 22 December 2014 11:54 Go to previous messageGo to next message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 246
Registered: July 2009
Senior Member
On 22-12-14 12:44, Al Go wrote:
> Thanks a lot, that what I did want.
> By the way, where can I find description of Arguments (/C, /K.. etc.)?

http://technet.microsoft.com/en-us/library/6ec588db-31a9-4a73-a970-65a2c6f4abbe


Cheers,

Joost
Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1522611 is a reply to message #1522579] Mon, 22 December 2014 12:20 Go to previous messageGo to next message
Al Go is currently offline Al GoFriend
Messages: 4
Registered: December 2014
Junior Member
>Joost Kraaijeveld, Klaus Mr

Thanks again, it is very useful.
But I have one minor issue with the described above method.
My program during execution should load external image file from the same catalog where .exe file is, let say "img.png".
When I run program manually, everything goes ok.
But when I run it with the described above method via "External Tool Configuration", the program is unable to load this file and I get error message:
"Failed to load image "img.png". Reason: Unable to open file"
I suppose this is due to run cmd.exe not from the catalog where .exe file is.
Is it possible to fix it somehow, to be possible to load the file when run the program from inside Eclipse?

Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1523006 is a reply to message #1522611] Mon, 22 December 2014 17:28 Go to previous messageGo to next message
Klaus km is currently offline Klaus kmFriend
Messages: 142
Registered: November 2011
Senior Member
Quote:
But I have one minor issue with the described above method.


Do you now what a working directory is? No? Then please read:
http://en.wikipedia.org/wiki/Working_directory

Then check the Arguments page carefully and change the setting suitable for your needs.

Quote:
But when I run it with the described above method via "External Tool Configuration", the program is unable to load this file and I get error message:
"Failed to load image "img.png". Reason: Unable to open file"

This is bad coding style, the program should catch errors.

Smile

regards,
Klaus



Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1816836 is a reply to message #1523006] Fri, 08 November 2019 01:13 Go to previous messageGo to next message
Peter Schneider is currently offline Peter SchneiderFriend
Messages: 1
Registered: November 2019
Junior Member
This method doesnt work anymore.

This post is really old maybe there is a newer Method?

For me no terminal starts up and also no errors,

Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1818363 is a reply to message #1816836] Fri, 13 December 2019 10:30 Go to previous messageGo to next message
M m is currently offline M mFriend
Messages: 2
Registered: December 2019
Junior Member
This method only works with old eclipses. Anyone know how to do it with the new eclipse?

Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1818410 is a reply to message #1818363] Sat, 14 December 2019 18:57 Go to previous message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 246
Registered: July 2009
Senior Member
Please create a new topic instead of reusing a topic from ancient history. What are you trying to achieve, what did you do and what did you observe?

Gr


Joost


Cheers,

Joost
Previous Topic:C++ project - analyze code size in my project
Next Topic:Looking for description of CDT "Project Explorer " icons
Goto Forum:
  


Current Time: Sun Jun 07 10:53:24 GMT 2020

Powered by FUDForum. Page generated in 0.02552 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top