Code::Blocks Forums

User forums => Help => Topic started by: Shekhu on May 09, 2013, 10:11:10 pm

Title: No console output with mingw-w64-gcc-4.8.0-stable-r7
Post by: Shekhu on May 09, 2013, 10:11:10 pm
Hi,

I downloaded mingw-w64-gcc-4.8.0-stable-r7 and wrote a simple program before moving on to unique pointers (C++11).

Code
#include<iostream>

using namespace std;

int main()
{
    cout<<"hello"<<endl;
    return 0;
}

The code compiles without errors, but I get no output on running it.

Code
Process returned 1970924701 (0x7579EC9D)   execution time : 0.002 s
Press any key to continue.

I'm running it on 32 bit Vista.

When I compile with option "-m32", I get the following errors while compiling.

Code
C:\Users\Shekhu.ROMMELSMACHINE\Documents\Code Blocks Programs\auto.o:auto.cpp|| undefined reference to `___main'|
C:\Users\Shekhu.ROMMELSMACHINE\Documents\Code Blocks Programs\auto.o:auto.cpp|| undefined reference to `__ZSt4cout'|
C:\Users\Shekhu.ROMMELSMACHINE\Documents\Code Blocks Programs\auto.o:auto.cpp|| undefined reference to `__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'|
C:\Users\Shekhu.ROMMELSMACHINE\Documents\Code Blocks Programs\auto.o:auto.cpp|| undefined reference to `__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_'|
C:\Users\Shekhu.ROMMELSMACHINE\Documents\Code Blocks Programs\auto.o:auto.cpp|| undefined reference to `__ZNSolsEPFRSoS_E'|
C:\Users\Shekhu.ROMMELSMACHINE\Documents\Code Blocks Programs\auto.o:auto.cpp|| undefined reference to `__ZNSt8ios_base4InitD1Ev'|
C:\Users\Shekhu.ROMMELSMACHINE\Documents\Code Blocks Programs\auto.o:auto.cpp|| undefined reference to `__ZNSt8ios_base4InitC1Ev'|
C:\Users\Shekhu.ROMMELSMACHINE\Documents\Code Blocks Programs\auto.o:auto.cpp|| undefined reference to `_atexit'|
||=== Build finished: 8 errors, 0 warnings (0 minutes, 0 seconds) ===|

Can anybody please help? And I have the option -std=C++11 set.
Title: Re: No console output with mingw-w64-gcc-4.8.0-stable-r7
Post by: Alpha on May 09, 2013, 10:40:24 pm
Those are link time errors; it appears that you have somehow disabled the standard runtime library, however, it is difficult to find the cause without the full build log.

If you do not specifically need GCC 4.8, I recommend using the TDM build (http://tdm-gcc.tdragon.net/), which works well out of the box.
Title: Re: No console output with mingw-w64-gcc-4.8.0-stable-r7
Post by: Shekhu on May 09, 2013, 11:28:10 pm
Thanks Alpha. I have installed TDM GCC. It's working fine. I wanted to get a hands-on on the C++ features. So i downloaded 4.8. But looks like 4.7 also supports these new features.