Although I hate to admit it, I'm reasonably new to c++ - I often have little to no idea what each error means, which is why I'm asking for help.
So, I recently obtained a copy of Visual Studio 2002, and have been trying to complie a small game with it.
However, whenever I try to compile, I get the following:
So, beacuse of by newness to C++, I can't seem to fix these errors - source code:Code:------ Rebuild All started: Project: Vacuus - IFD, Configuration: Debug Win32 ------ Deleting intermediate files and output files for project 'Vacuus - IFD', configuration 'Debug|Win32'. Compiling... stdafx.cpp Compiling... Vacuus - IFD.cpp c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(7) : error C2065: 'string' : undeclared identifier c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(7) : error C2146: syntax error : missing ')' before identifier 'msg' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(7) : error C2059: syntax error : ')' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(19) : error C2501: 'time' : missing storage-class or type specifiers c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(19) : error C2440: 'initializing' : cannot convert from 'time_t *__w64 ' to 'int' This conversion requires a reinterpret_cast, a C-style cast or function-style cast c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(21) : error C2501: 'srand' : missing storage-class or type specifiers c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(21) : error C2365: 'srand' : redefinition; previous definition was a 'function' c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\stdlib.h(305) : see declaration of 'srand' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(25) : error C2146: syntax error : missing ')' before identifier 'msg' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(25) : error C2086: 'int prompt' : redefinition c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(7) : see declaration of 'prompt' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(25) : error C2059: syntax error : ')' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(26) : error C2143: syntax error : missing ';' before '{' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(26) : error C2447: '{' : missing function header (old-style formal list?) c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(46) : error C2064: term does not evaluate to a function c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(47) : error C2065: 'cin' : undeclared identifier c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(47) : error C2228: left of '.get' must have class/struct/union type c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(51) : error C2064: term does not evaluate to a function c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(52) : error C2296: '>>' : illegal, left operand has type ''unknown-type'' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(54) : error C2064: term does not evaluate to a function c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(54) : error C2296: '>>' : illegal, left operand has type ''unknown-type'' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(56) : error C2064: term does not evaluate to a function c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(57) : error C2064: term does not evaluate to a function c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(58) : error C2064: term does not evaluate to a function c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(59) : error C2296: '>>' : illegal, left operand has type ''unknown-type'' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(67) : error C2065: 'cout' : undeclared identifier c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(67) : error C2296: '<<' : illegal, left operand has type ''unknown-type'' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(67) : error C2297: '<<' : illegal, right operand has type 'char [29]' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(69) : error C2296: '<<' : illegal, left operand has type ''unknown-type'' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(69) : error C2297: '<<' : illegal, right operand has type 'char [31]' c:\Documents and Settings\def\My Documents\Visual Studio Projects\Vacuus - IFD\Vacuus - IFD.cpp(70) : error C2296: '>>' : illegal, left operand has type ''unknown-type''
Any ideas?Code:// Vacuus - IFD.cpp : Defines the entry point for the console application. // #include "stdafx.h" //Declarations int prompt(string msg); //This function not only returns the message provided, but also displays the interface //in the full version, their should be different "types" so that the message is displayed in different areas int sRand(int HIGH, int LOW); //Set Random function, used to set any integer to a randomly generated value, called like: num=sRand("69","7"); //In this version, this fuinction is called every time the player moves int begin_g(); //Used to begin the game, displays a welcome message before entering a while loop int pLx; //Player Location on the X plane, in the full version, like all other player vars. this var should be placed into a player class int pLy; //see above. int pHealth; //players health, doesn't change int input; //input variable, each pushed button should be stored in this time_t seconds; //For random stuff. time(&seconds); srand((unsigned int) seconds); //end declarations\\ int prompt(string msg) { cout<<"\tPLAYER\t\tLOCATION\n"; cout<<"\tTester\t\tX :: "<<pLx<<"\n"; cout<<"\t"<<pHealth<<"\t\tY :: "<<pLy<<"\n"; cout<<"\n--------------------------------------------------------------------------------\n\n"; cout<<"\t[m] Move\t[e] Exit\n"; cout<<"\t[h] Help\n"; cout<<"\n--------------------------------------------------------------------------------\n\n"; cout<<msg<<"\n>"; return 0; } int sRand(int HIGH,int LOW) { return rand() % (HIGH - LOW + 1) + LOW; } int begin_g() { int check;//Used in conjunction with the "sRand" function prompt("Welcome to the Vacuus Interface demo!\nThis demo serves to show you the interface in the upcoming space simulator, Vacuus.\nHowever, the demo also allows you, the player, to move throughout the universe,\n though its functionality is limited.\nIf you require any assitance, please type H into the console to display further information.\n\n SYS: Press <RETURN> to continue:"); cin.get(); while(input != 'e') { prompt(); cin>>input; if(input=='h') {prompt("This demo displays you the interface of an upcoming game.\n At the top of the screen, you will see some information on your player, including health, name & location.\n Below that, you will see a list of avaliable commands, each surrounded by '['s, and ']'s. Type a command to get any given effect.\nFinaly, you will see the message box, and command prompt.\n");cin>>input;} if(input=='m') {pLx++; check=sRand(3,1); if(check==1){prompt();} if(check==2){prompt("You've discovered another ship!");} if(check==3){prompt("You've discovered a planet!");} cin>>input; } } return 0; } int main() { cout<<"\t\tVacuus - Interface Demo 01"; cout<<"\n\t\t[1] New game.\n\t\t[2] Exit.\n>"; cin>>input; if(input!=1) { return 0; } begin_g(); return 0; }
Also, I was wondering if it is possible to open a file , whichs path would be contained in a variable - you see, I think I need to do that to make it moddable.
Thanks in advance.