Sign in to follow this  
Tigernado

Stuck in the begining of my book

Recommended Posts

Hi, I just signed up. Anyways, I just got Beginning C++ Game Programmimg and the common indroductory code....isnt working, so I can't compile it. At first I thought just thought it was my mistake a type or something(I am a beginner after all). But I ran the sorce code on the disc and that doesn't work either. So, what could be wrong? Heres the code: // Game Over // A first C++ program #include <iostream> int main() { std::cout << "Game Over!" << std::endl; return 0; } I'm using Bloodshed Dev-Cpp if you need to know that as well.

Share this post


Link to post
Share on other sites
Try copying the source code from the cd onto your hard disk and compiling it from there since the compiler won't be able to make .exe file on the cd since it's read-only.

Share this post


Link to post
Share on other sites
Quote:
Original post by whiz_kid
Try copying the source code from the cd onto your hard disk and compiling it from there since the compiler won't be able to make .exe file on the cd since it's read-only.


I tried that...same error

Share this post


Link to post
Share on other sites
Quote:
Original post by dek001
Are you creating New project>console application ??
er...I dont think so. It said to do New > Source File & that's what I did.

Share this post


Link to post
Share on other sites
I have that book but dont use bloodsheds compiler and i just installed it and did the game over in a console app and it worked so its worth doing with all source code from that book, I hope It helps.

*edit* Appendix A on the CD has a how to compile and run your first program in DEV C++ compiler.

Share this post


Link to post
Share on other sites
Quote:
Original post by dek001
I have that book but dont use bloodsheds compiler and i just installed it and did the game over in a console app and it worked so its worth doing with all source code from that book, I hope It helps.
thanks, but what kind of console application?

Share this post


Link to post
Share on other sites
If you're doing it in Dev-CPP, try THIS code: (it does the same thing)
// Game Over
// A first C++ program

#include <iostream>
using namespace std;

int main()
{
cout << "Game Over!" << endl;
cin.get();
}

Share this post


Link to post
Share on other sites
Open up Dev-cpp then click file->New->Project then select Console Application then type a name into the box and press ok, then you can remove the code that generated b y defalut and type yours in.

Share this post


Link to post
Share on other sites
Quote:
Original post by Tigernado
Quote:
Original post by dek001
I have that book but dont use bloodsheds compiler and i just installed it and did the game over in a console app and it worked so its worth doing with all source code from that book, I hope It helps.
thanks, but what kind of console application?


A console application is an app that uses the DOS window (in windows, DOS is called the command prompt, or the console). You should have an option to create a Win32 Console app when you create a new project.

Share this post


Link to post
Share on other sites
Quote:
Original post by Tigernado
Quote:
Original post by dek001
I have that book but dont use bloodsheds compiler and i just installed it and did the game over in a console app and it worked so its worth doing with all source code from that book, I hope It helps.
thanks, but what kind of console application?


When you click new project it should come with a box click the console application pic and click ok.

Share this post


Link to post
Share on other sites
Quote:
Original post by dek001
When u say didnt work what do you mean? did you get any errors??
Its actually the same error ive been getting the same line,message and everything

Share this post


Link to post
Share on other sites
Quote:
Original post by Tigernado
Quote:
Original post by dek001
When u say didnt work what do you mean? did you get any errors??
Its actually the same error ive been getting the same line,message and everything


if you look on the cd and look in appendices folder and open and read appa.pdf that will tell you how to setup and run your first program with Dev C++

Share this post


Link to post
Share on other sites
Quote:
Original post by Dark_Flame
I use Dev c++ and i tried that and it worked perfectly...what book is it?
It was in the first post "Beginning C++ Game Programming"

Share this post


Link to post
Share on other sites
Quote:
Original post by Tigernado
Beginning C++ Game Programmimg


It ran fine for me aswell so i dont know whats wrong.

Share this post


Link to post
Share on other sites
Quote:
Original post by dek001
Quote:
Original post by Tigernado
Beginning C++ Game Programmimg


It ran fine for me aswell so i dont know whats wrong.
me either but I tried what all of you said so far, so I'm not sure what I'm doing wrong.

Share this post


Link to post
Share on other sites
Ok, here's what you do:
1.) Create a new text file in a folder.
2.) Change the name to GameOver.cpp
3.) Now, open it with Dev-Cpp and put the code in it.
4.) Hit F9 and compile it. It should run now. (Also, replace 'return 0;' with 'cin.get();' this keeps the window open.

Share this post


Link to post
Share on other sites
Quote:
Original post by orcfan32
Ok, here's what you do:
1.) Create a new text file in a folder.
2.) Change the name to GameOver.cpp
3.) Now, open it with Dev-Cpp and put the code in it.
4.) Hit F9 and compile it. It should run now. (Also, replace 'return 0;' with 'cin.get();' this keeps the window open.



// Game Over
// A first C++ program

#include <iostream>

int main()
{
std::cout << "Game Over!" << std::endl;
cin.get();
}

This is what is should look like, correct? I tried it that way, same results.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this