I have installed the eclipse ide(cdt) on my windows 8 laptop and tried writing a simple c program to check whether the program executes.
It did not execute and gave the error : binary not found
.
So I did some searching online and realized that my system did not have a c/c++ compiler installed.
So I installed MinGW and selected the c and c++ compilers during installation.
Then I set the PATH environment variable to C:\MinGW.
I reopened eclipse, wrote a simple c program and it worked as expected!
I created a c++ project, wrote a simple piece of code and could not see the output in the console!
Here is the code:
#include<iostream>
using namespace std;
int main()
{
cout<<"sample text";
return 0;
}
You may simply need to flush the output, using
flush
orendl
. Try this:or
Linker (Option) > Add Command (g++ -static-libgcc -static-libstdc++)
This is not the right solution.
You have in your path environment variable only
c:\minGW
.But it should be
c:\minGW;c:\minGW\bin
. (Set the PATH before open eclipse)Therefore,
libstdc++-6.dll
needed by the current program, can not be found.In eclipse there is no error, but no output in the console !!
It to compile into the program may be regarded as a trick, but will only work for the standard libs .
your linker flags should not be set like :
--> MinGW C++ Linker (Option) > Command (g++ -static-libgcc -static-libstdc++)
should be set here :
I know in this case it is not necessary at the end
<< endl
to write.A good programming style should use
<< endl
: