Dev-C++ doesn't work anymore

Started by
11 comments, last by jpetrie 13 years, 4 months ago
Hello all.

I am a mediocre programmer and make win32 applications and games. However, recently I started to teach a friend of mine (we're both freshmen at a governor's school) all about c++. He was a complete noob, knowing only how to declare and multiply variables and stuff. He didn't even know modulus! But I digress.

I haven't programmed console applications in a long time, but when I started teaching him, I found that console applications won't work anymore. I have tried installing a new version and uncompressing all of the files in the include folder, but nothing worked.

The only way console applications will work is that a make a project, but I would like to teach him through a source file first before moving on to projects, and I need to be sort of a role model for his teachings.

Here is the code:

#include <iostream>

using namespace std;

int main()
{
cout << "hi-o\n\n";
system("pause");
return 0;
}

I know it works, but it just doesn't. All the window shows is the 'Press any key too continue...' pause command thingy. No 'hi-o' can be seen.

If any of you know what's going on, please help!

I'm sorry about any spelling or grammar mistakes or any undue brevity, as I'm most likely typing on my phone

"Hell, there's more evidence that we are just living in a frequency wave that flows in harmonic balance creating the universe and all its existence." ~ GDchat

Advertisement
Dev-C++ is considerably out of date and unmaintained. Consider Microsoft's Visual Studio 2010 Express as an equally free and superior solution.
This isn't a Writing for Games topic. Moved to For Beginners.
cout << "hi-o\n\n";

instead of \n use std::endl:
cout << "hi-o" << std::endl << std::endl;

Optionally, there is a way to explicitly flush the output buffer:
cout << "hi-o" << std::endl << std::endl << std::flush;


Quote:I found that console applications won't work anymore.

I am pretty sure they do!

Apart from that, I agree with rip-off: don't use dev-c++.
std::cout << std::endl is equivalent to std::cout << '\n' << std::flush. Sending std::endl to a stream flushes it twice, and following with another std::flush is pointless.

It sounds like the program was set as a Win32 project, rather than a console one. Its been years since I've touch Dev-C++ so I honestly wouldn't know where you can change this setting. As a result the console window was only created when the system() call created the PAUSE process.
Quote:Dev-C++ is considerably out of date and unmaintained. Consider Microsoft's Visual Studio 2010 Express as an equally free and superior solution.


Also consider code::blocks 10.04
The sad thing is that somebody is still forking over money to host this...
If you want to teach your friend the basics,
Scratch all IDEs and teach him

>g++ test.cpp

That will suffice for compiling all simple files.
The next step with headers and inclusion of object modules
Is still easy in the command line. I agree you could use vsexpress,
But start simple, and vs ain't IMHO.

thats my advice. And then there's code::blocks...

Try "\r\n" and se if that works.
Quote:Original post by lonewolff
Try "\r\n" and se if that works.

C++ streams will convert the newline character '\n' to the system newline, even if the system newline is multiple characters. This can be disabled by opening the streams in so-called "binary" mode.

This topic is closed to new replies.

Advertisement