Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse CDT : running C++ program not showing anything in the console! Why?

I'm running the latest version of Eclipse with CDT on Windows 64 bits with Cygwin for compiling the code.

My problem is that when i run any c++ software in eclipse, there is no output in the console.

I have tried this:

Eclipse CDT debugger does not show console

and this:

Eclipse CDT Debug console not displaying program output

But it does not works.

like image 289
Phil Avatar asked Nov 11 '11 20:11

Phil


People also ask

Can we execute C program in Eclipse?

Eclipse is popular for Java project development. It also supports C/C++, PHP, Python, Perl, and other web project developments via extensible plug-ins. Eclipse is cross-platform and runs under Windows, Linux and Mac OS.

How do I display output in Eclipse?

Inside Eclipse -> Click on "Window" Select "Show View" Then select "Console" If you cannot see console in the list, select "Other" and then search for "console' in new dialog at top and select "Console"

Does Eclipse CDT come with compiler?

Unfortunately Eclipse only provides the Integrated Development Environment (IDE) but it is missing the actual compiler. To install a compiler, please follow the instructions for your operating system.


2 Answers

As guys at "No Console Output (MinGW, CDT)" point out, this is probably (or at least sometimes) because Eclipse does not add PATH to MINGW\bin when launching the executable, so:

In the "Environment" tag, press "New", set it as:

  • "Name:PATH"
  • "Value:C:\MinGW\bin"

;)

like image 168
mlvljr Avatar answered Sep 21 '22 03:09

mlvljr


Another solution that works (other than mlvljr's) is by adding the -static flag in:

Project > Properties > C/C++ Build > Settings > Tool Settings > MinGW C++ Linker > Miscellaneous > Linker Flags

like image 24
Sheharyar Avatar answered Sep 19 '22 03:09

Sheharyar