Jump to content
  • Advertisement
Sign in to follow this  
CulDeVu

Dev-C++ doesn't work anymore

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

If you intended to correct an error in the post then please contact us.

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.

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

Share this post


Link to post
Share on other sites
Advertisement
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++.

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!