Eclipse CDT - how to run compiled .exe in external

2020-07-25 09:03发布

问题:

Is there a way to run compiled CDT program inside Eclipse IDE, but not in Eclipse 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. I googled this, on my mind, simple question, but (what is strange for me) I didn't find the answer.

回答1:

From Eclipse CDT forum, from Mr Klaus:

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!