【问题标题】:Running the C++ app from the Eclipse IDE从 Eclipse IDE 运行 C++ 应用程序
【发布时间】:2012-12-22 12:06:28
【问题描述】:

我正在使用 Eclipse IDE。我这里有一些基本的源代码,包括头文件。一直使用 cygwin 作为 C++ 编译器。它编译我的应用程序并且不会产生任何错误。但是我在 IDE 的控制台上看不到输出。当我自己运行可执行文件时,它会产生输出。如何配置 Eclipse IDE 以将输出重定向到 IDE 的控制台?

这就是我得到的全部:

15:40:11 **** Incremental Build of configuration Debug for project GetCompiled ****
make all 
Building target: GetCompiled.exe
Invoking: Cygwin C++ Linker
g++  -o "GetCompiled.exe"  ./Compiling.o   
cygwin warning:
  MS-DOS style path detected: D:\Aristotelis\C++\GetCompiled\Debug
  Preferred POSIX equivalent is: /cygdrive/d/Aristotelis/C++/GetCompiled/Debug
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Finished building target: GetCompiled.exe


15:40:12 Build Finished (took 702ms)

要运行的选定应用程序:

我尝试通过选择作为 C++ 应用程序运行来从 IDE 运行 exe 文件,但它不会产生任何输出。 最好的问候

【问题讨论】:

  • 有不同的控制台,看看你用的是哪一个,然后试试其他的。

标签: c++ eclipse configuration output post-build-event


【解决方案1】:

Eclipse/CDT 不会在每次构建后自动运行您的应用程序。您需要通过菜单 Run->Open Run->Run 或使用键盘快捷键 Crtl+F11,然后再次检查 Console 窗口。

一项高级功能是将您的应用程序设置为构建后事件。为此,请转到您的构建设置并找到适当的子菜单并在那里输入您的 application.exe 的名称(我现在还没有 Eclipse)。使用此设置,应用程序将在每次成功构建后自动启动。如果您进行自动化单元测试,这会派上用场。

【讨论】:

  • 是的,我在构建应用程序后运行它。执行了上述建议,但没有任何好处。
  • 您是否安装了 CDT 并且可以运行 MinGW 而不是 Cygwin? Nuwen 发行版特别适合 Windows 上的 Eclipse(它已经编译了 Boost,例如),请参阅 nuwen.net/mingw.html
  • 据我所知,CDT 已成为 Eclipse 的一部分;它有一些关于 CDT 的可选选择复选框。我创建了一个选择 MinGW 的新项目,但和以前一样没有输出。
猜你喜欢
  • 2014-05-03
  • 1970-01-01
  • 2018-12-03
  • 1970-01-01
  • 1970-01-01
  • 2011-10-12
  • 2017-03-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多