Public Group

Dev-C++ doesn't work anymore

This topic is 2837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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.

Share on other sites
Dev-C++ is considerably out of date and unmaintained. Consider Microsoft's Visual Studio 2010 Express as an equally free and superior solution.

Share on other sites
This isn't a Writing for Games topic. Moved to For Beginners.

Share on other sites
cout << "hi-o\n\n";

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++.

Share on other sites
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.

Share on other sites
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

Share on other sites
The sad thing is that somebody is still forking over money to host this...

Share on other sites
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...

Share on other sites
Try "\r\n" and se if that works.

Share on other sites
Quote:
 Original post by lonewolffTry "\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.

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
18
5. 5

• 32
• 13
• 10
• 11
• 9
• Forum Statistics

• Total Topics
632562
• Total Posts
3007094

×