Compiling Errors

jchase520

Newbie
Joined
Feb 3, 2010
Messages
1
Reaction score
0
ok , heres my code i been workin on today, i get a bunch of errors here, wierd ones, the first being I included string & even tried string.h and still my const string is given a error ( I know strings are a user defined data type in C++)

also I know that most of this stuff has no effect right now, this code is still a work in progress with allot of psuedo code, but it should still compile all the syntex seems ok.

Code:
/*
	Fall Of Saigon Game Modes
		This code will handle the game modes in FOS.


	Author: Jared S Chase AKA RapHero AKA J-Chase
	Site: http://fallofsaigon.forumotion.com/forum.htm
	Date: 2/02/2010
	Version: 0.001

	0.001 - The creation of the games modes.

*/

//-- Include cbase, the base & required header file

#include <cbase.h>
#include <string.h>

//-- Set the flags model in a const string so it can be changed easily at any time

const string flagModel = "set the flag model path here";

//-- Get the game mode from RCON server settings

int getGameMode()
{
	//get game mode from cvar here once the rcon commands are programed
	int gameMode;

	switch(gameMode)
		case 1: startCommandPoint(); // rcon cvar should return 1 for command point
		case 2: startCaptureTheFlag(); // rcon cvar should return 2 for CTF
		case 3: startDeathMatch(); // rcon cvar should return 3 for DM
	return gameMode; // return the gameMode as a integer
}

//-- Create the flag entity, pass the location to create as x,y,z.
//-- Return entity ID as integer or -1 if it fails.

int createFlagEntity(double x, double y, double z)
{
	return flagEntityId;
}

and here are the errors:

Code:
1>------ Build started: Project: Server HL2MP, Configuration: Release Win32 ------
1>Compiling...
1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
1>fos_game_modes.cpp
1>.\fos_game_modes.cpp(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\fos_game_modes.cpp(23) : error C2146: syntax error : missing ';' before identifier 'flagModel'
1>.\fos_game_modes.cpp(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\fos_game_modes.cpp(23) : error C2440: 'initializing' : cannot convert from 'const char [29]' to 'int'
1>        There is no context in which this conversion is possible
1>.\fos_game_modes.cpp(33) : error C3861: 'startCommandPoint': identifier not found
1>.\fos_game_modes.cpp(34) : error C2046: illegal case
1>.\fos_game_modes.cpp(34) : error C3861: 'startCaptureTheFlag': identifier not found
1>.\fos_game_modes.cpp(35) : error C2046: illegal case
1>.\fos_game_modes.cpp(35) : error C3861: 'startDeathMatch': identifier not found
1>.\fos_game_modes.cpp(44) : error C2065: 'flagEntityId' : undeclared identifier
1>Build log was saved at "file://d:\Fall Of Saigon\src\game\server\Release_hl2mp\BuildLog.htm"
1>Server HL2MP - 10 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

any help would be greatly apreciated
 
If you want to use the std::string from the <string> header you need to use std::string, not string (you can use string if you are using namespace std; though).
You should probably break; after each case, and flagEntityId isn't defined anywhere.
 
Back
Top