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

## Recommended Posts

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.

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

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

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

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

##### Share on other sites
Quote:
 Original post by LordofMuffinsAlso, 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 LordofMuffinsSo 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

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

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

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

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

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 12
• 10
• 9
• 15
• 22