Skip to main content



      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 12:44 Go to next message
Eclipse UserFriend
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 13:05 Go to previous messageGo to next message
Eclipse UserFriend
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 06:44 Go to previous messageGo to next message
Eclipse UserFriend
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 06:54 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to run automatically compiled .exe in external console (cmd.exe) [message #1522611 is a reply to message #1522579] Mon, 22 December 2014 07:20 Go to previous messageGo to next message
Eclipse UserFriend
>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 12:28 Go to previous messageGo to next message
Eclipse UserFriend
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] Thu, 07 November 2019 20:13 Go to previous messageGo to next message
Eclipse UserFriend
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 05:30 Go to previous messageGo to next message
Eclipse UserFriend
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 13:57 Go to previous message
Eclipse UserFriend
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
Previous Topic:C++ project - analyze code size in my project
Next Topic:Looking for description of CDT "Project Explorer " icons
Goto Forum:
  


Current Time: Tue Jun 24 19:52:46 EDT 2025

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

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

Back to the top