# Dev-C++ doesn't work anymore

This topic is 2627 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.

##### Share on other sites
Thank you all for your replies, but I don't think you understand. The escape sequences aren't the problem. The program doesn't show any output except for the system("pause") command. I don't understand this because console applications worked about 3 or 4 months ago. And it's not all of C++ that's not working. I program Win32 applications almost every day.

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

I would prefer not to teach him using MSVC++. Microsoft tries to make it's own rules and standards, and disregards a lot of the ISO C++, but that's for a different post entirely.

When I create a batch file for the executable to run (just to see what it would do), the same thing happened. When I take out the system("pause") command, the window shows nothing.

##### Share on other sites
I just realized something. The title bar (where it would say the file name of the program) reads:

C:\WINDOWS\system32\cmd.exe

I went and looked at this program, and is something totally different from my program, with the exception that it can run the pause command. Could this have anything to do with it?

##### Share on other sites
Quote:
 I would prefer not to teach him using MSVC++. Microsoft tries to make it's own rules and standards, and disregards a lot of the ISO C++, but that's for a different post entirely.

Hardly.

Every compiler in existence amends the standard with their own extension -- Microsoft's cl.exe and (modern) versions of the GCC are generally regarded as the most standard-compliant compilers out there in general production use (Comeau is allegedly better, but is far less widespread). With MSVC you can disable language extensions in the project settings, which will do what you want. At that point you're only missing what cl.exe fails to implement correctly according to the standard, which is mostly really obscure template-related stuff and mostly the same kind of stuff GCC gets wrong as well.

Besides, the version of GCC that comes with Dev-C++ is woefully out of date and probably less standard compliant than cl.exe or a modern GCC build.

In any case, the code you supplied in your original post is perfectly compliant, although overly verbose -- 'return 0' can be omitted in main and system("pause") is unnecessary if the program is invoked from the IDE properly (if I recall, there are two or three invocation commands in Dev-C++ and one of them will hold the console window open without you needing put bullshit code in there to do it; this is certainly true of more modern IDEs at least).

So it sounds like the problem may be in your project configuration or installation itself.