Author Topic: Problem with the MinGW package  (Read 4221 times)

Offline wav

  • Single posting newcomer
  • *
  • Posts: 2
Problem with the MinGW package
« on: February 11, 2013, 07:09:28 am »
Newbie to CB  :) and have 2 questions re downloading the software:

1) Among the following 4, do I need only to download one of them?
codeblocks-12.11-setup.exe
codeblocks-12.11-setup_user.exe
codeblocks-12.11mingw-setup.exe
codeblocks-12.11mingw-setup_user.exe

2) I tried both codeblocks-12.11mingw-setup.exe and codeblocks-12.11-setup.exe. The one without mingw works fine, but the one with mingw has this problem: After a program is run, the output flashes away and doesn't stay on the screen; why? I thought the one with mingw, being a much larger file (96 MB vs. 28 MB), should be better? (And why "minimalist" is actually a  larger file?)

Thanks in advance for help.

Offline dominover

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: Problem with the MinGW package
« Reply #1 on: February 12, 2013, 01:05:16 pm »
I'm assuming the one without MinGW is just Code::Blocks where you have to incorporate your own compiler.  The one with MinGW is the on you want if you want to program in C++, unless you are incorporating another compiler of your own.  I'm not overly advanced myself on this topic but I use the code::blocks with MinGW setup.exe.

As for the output (I am assuming you mean the binary files you are building)>>

There's probably nothing wrong with the programs you are writing except for one thing, you aren't pausing it at the end.   I'm possibly totally off the mark here but I'll put my ten cents in anyway.

If this is what you mean, try this.

Code
#include <cstdlib>


///at the end of main, where you want to view the output write in

system("pause>nul");  

//You can write system("pause"); too but I prefer the first example because
//it doesn't display "press any key to continue" message at the end.
« Last Edit: February 12, 2013, 01:38:08 pm by dominover »

Offline jarod42

  • Multiple posting newcomer
  • *
  • Posts: 87
Re: Problem with the MinGW package
« Reply #2 on: February 12, 2013, 01:37:34 pm »
installer with 'mingw' in the name provide C::B + Mingw (which contains gcc/g++ toolchain)
installer with/without 'user' in the name is to manage admin rights restriction.

Instead of system("pause>nul"); in your program,
you may just pause using 'Pause when executions ends' option in
Project -> properties... -> build targets

Offline wav

  • Single posting newcomer
  • *
  • Posts: 2
Re: Problem with the MinGW package
« Reply #3 on: February 12, 2013, 08:29:12 pm »
Thanks for the replies, but neither seems to solve my problem. I knew I could add a statement to make the output stay on the screren (beside pause, I could also add cin.get()). But my question is, I didn't have that problem at all using the package without MinGW (output stays), but how come I can't do without an extra statement for the one with MinGW?

Also, I didn't incorporate any of my compiler with the one without MinGW. It just worked.

Any more insights? Thank in advance.

Offline dominover

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: Problem with the MinGW package
« Reply #4 on: February 13, 2013, 04:07:23 am »
Hmm, well it's hard to know what you've done there mate. 
Did you try theProject -> properties... -> build targets > (tick 'Pause when execution ends')?