So I just downloaded Dev C++ Beta 5...major help

Started by
17 comments, last by cignox1 19 years, 7 months ago
I'm using a Micron 1998 (my newer computer isn't working at the moment) and just downloaded this compiler. Keep in mind this is one of my first programs...so I'm learning from a visual C++ book, and put in the basic line of code minus the void of course, to make it compatible. So it compiles and I decide to execute it...of course something always has to go wrong with this piece of crap. So the compiler window minimizes itself and I see a ms-dos screen where my compiled program should be but instead nothing appears and the compiler maximizes itself. And then the ms-dos screen dissapears. I've done this plenty of times and it does the same thing. Is there some setting I have to turn on? Thanks.
Advertisement
It's working correctly.

The program is starting (black box appears), running, and terminating (black box disappears).

put system("pause"); at the end of main and add #include <cstdlib> at the top (I think cstdlib will get 'system', if not use iostream)
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
So I have to do this with every program? Or can I add it to a header or something? Sorry, I'm new to coding. What if I do this with a game? What do I do then?
You can setup a tool to run programs so that it won't dissappear.

cmd /K (program)

There's a special code for the name of the program but I don't remember what it is, and I don't feel like installing it to find out.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
Also, does anyone else run this compiler? It's weird. It only compiles when I don't put pound signs next to include...what's up with that? Does it have to do with the fact that the book is Visual c++? (keep in mind I'm removing the void)
Quote:Original post by LordofMuffins
Also, does anyone else run this compiler? It's weird. It only compiles when I don't put pound signs next to include...what's up with that? Does it have to do with the fact that the book is Visual c++? (keep in mind I'm removing the void)


show an example of what you're talking about. it shouldn't allow you to just:

include <windows.h>


or whatever.


Quote:Original post by LordofMuffins
So I have to do this with every program? Or can I add it to a header or something? Sorry, I'm new to coding. What if I do this with a game? What do I do then?


what you are building is called a "console" program and is meant to be run from the console not by double-clicking it. that's why it "acts wierd". if you run it through the console window DOS style it'll look much happier.

-me
...Uhh...pound signs next to include but you're removing the void? What...what the hell are you TALKING about? NICK NO UNDERSTAND. BRAIN HURT. FEEL...THE EUROMINT.
Things change.
If something compiles when you do this:
include <stdio.h>

but does not compile when you do this:
#include <stdio.h>

then it's not a C/C++ compiler. The pound signs are required for preprocessor directives in the language.

I believe you can (still) download the free command-line compiler and linker for VC++ from Microsoft. You don't get the nice integrated environment with debugger, but you do get a working compiler that's probably much closer to that book of yours.

To compile "foo.cpp" and run it as "foo.exe" in the command window, assuming that compiler is in your path, you do:
C:\myproject> cl foo.cppcompilation status goes hereC:\myproject> foo.exe

enum Bool { True, False, FileNotFound };
It does. It only compiles when I put, for example:

include <iostream.h>

It won't work with:

#include <iostream.h>

When it doesn't compile (when I use the above line of code) it says it's on line 6, but I can't find anything wrong with line 6! Then I erase the # and it compiles. WTF? Is it my OS? This is a really old and easily crashable computer. I really want to know how to view my programs as well. I'm thinking about getting http://www.amazon.com/exec/obidos/tg/detail/-/1931841098/qid=1096405112/sr=8-1/ref=pd_csp_1/002-8255526-7521632?v=glance&s=books&n=507846 <---- this book, does anyone know if it comes with a C++ compiler?

Edit: Thanks hplus :-)
please just post your code. there's probably something else wrong with it that's making it bizarro like this. use [*source] [/source] tags (without the asterix to wrap your code so it looks pretty.

-me

This topic is closed to new replies.

Advertisement