G++/MinGW not compiling right...

I've searched everywhere for a solution to this, but to no avail.

To be clear and to save time, I've already tried:

[A] Uninstalling/reinstalling MinGW (w/ GCC and G++ and all utils and libraries)
[B] Manually installing MinGW
[C] My path is set to my MinGW bin folder.
[D] The G++ command works with the same file on my Ubuntu Laptop

I've tried using the MinGW get installer, I've tried manually installing it, and I've tried using the version packaged with CodeBlocks and they all produce the same issue. I posted this in the beginner forum because it involves setup and I've seen other people trying to learn C++ with this issue.

To issue is...


The problem I've been having is that MinGW/G++ appears to be missing the <iostream> header file. I've installed all the libraries with MinGW but when I attempt to compile the following program, no error is thrown and no files are outputted.
Code:


1
2
3
4
5
6
7
8
9
#include <iostream>

using namespace std;

int main()
{
  cout << "This will not produce a .exe!" << endl;
  return 0;
}


The following won't work either, showing that the problem has to be <iostream>:

1
2
3
#include <iostream>

int main(){}


What Have I found?


After searching and digging through all the MinGW/G++ header files in the include directory, I have found that there is no iostream header file. There's conio.h, system.h, and other standard headers. Just no iostream.h. I think this is relevant because the following code successfully produced a fully functioning .exe.

Code:
1
2
3
4
5
6
7
8
9
#include <cstdlib>

using namespace std;

int main()
{
  system("echo This will produce a functioning .exe!");
  return 0;
}


Any ideas?
when I attempt to compile the following program, no error is thrown and no files are outputted.
What's the command you're issuing? If it was simply that a header file was missing, you should be getting an error.
Last edited on
Note that just because you couldn't find <iostream> doesn't mean its not there. For example, for my version of MinGW, the <iostream> header can be found on the following path:
mingw32\lib\gcc\i686-w64-mingw32\4.8.1\include\c++\iostream

Also, it would help if we saw the errors that you are getting - it could shed some light on this situation.
I don't have any errors, that's the problem.

g++ main.cpp -o main.exe

is what I'm using
Well, I'm stumped. Maybe try using procmon to see what g++ is doing with the file system?
Topic archived. No new replies allowed.