Original Post
Why am i getting these errors?
Look at posts below
[edited by - Mat1515 on May 1, 2004 12:58:07 PM]
CCamera * g_Camera; //our camera!
g_Camera = new CCamera;
--------------------Configuration: Drag Race 2 - Win32 Debug--------------------
Compiling...
Main.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Drag Race 7\Main.cpp(30) : error C2501: ''g_Camera'' : missing storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\Drag Race 7\Main.cpp(30) : error C2040: ''g_Camera'' : ''int'' differs in levels of indirection from ''class CCamera *''
C:\Program Files\Microsoft Visual Studio\MyProjects\Drag Race 7\Main.cpp(30) : error C2440: ''initializing'' : cannot convert from ''class CCamera *'' to ''int''
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.
Drag Race 2.exe - 3 error(s), 0 warning(s)
quote:
c:\program files\microsoft visual studio\myprojects\drag race 7\main.cpp(30) : error C2501: ''g_Camera'' : missing storage-class or type specifiers
quote:
c:\program files\microsoft visual studio\myprojects\drag race 7\main.cpp(30) : error C2040: ''g_Camera'' : ''int'' differs in levels of indirection from ''class CCamera *''
#ifndef _CAMERA_H
#define _CAMERA_H
//***********************************************CAMERA CLASS*****************//
//VECTOR CLASS For Camera Movement Only
class CVector3 {
public: //Public Access
CVector3() {}
CVector3(float X, float Y, float Z) { //Class Constructor
x = X; y = Y; z = Z;} //Initiante to Starting Values
CVector3 operator+(CVector3 vVector){ //Overloaded + operator
return CVector3(vVector.x + x, vVector.y + y, vVector.z + z);}
CVector3 operator-(CVector3 vVector){ //Overloaded - operator
return CVector3(x - vVector.x, y - vVector.y, z - vVector.z);}
CVector3 operator*(float num){ //Overloaded * operator
return CVector3(x * num, y * num, z * num);}
CVector3 operator/(float num){ //Overloaded / operator
return CVector3(x / num, y / num, z / num);}
float x, y, z;
};
//CAMERA CLASS prototype
class CCamera{
public:
CVector3 m_vPosition; //Camera Position
CVector3 m_vView; //Camera View
CVector3 m_vUpVector; //Up Direction
//m = member Variables
//Camera Constructor
CCamera();
void RotateView(float angle, float x, float y, float z);
//Rotates Camera on someangle
void PositionCamera(float positionX,float positionY,float positionZ,
float viewX,float viewY,float viewZ,
float upVectorX, float upVectorY, float upVectorZ);
//Puts Camera at Posistion looking at Something a Position
void MoveCamera(float speed); //Moves the camera up or down
void SetViewByMouse(); //Set the view by the mouse posistion
void Look(); //Sets the camera to look at something
};
extern CCamera *g_Camera; //Allows all source files to use this
#endif
#pragma comment(lib, "opengl32.lib") //Open Gl stuff
#pragma comment(lib, "glu32.lib") //Open Gl stuff
#pragma comment(lib, "glaux.lib") //Open gl Stuff
#include "Globals.hpp" //Global Includes
#include "Models.h" //For models
#include "Camera.hpp" //Camera Stuff
#include "Render.hpp" //Drawing Stuff
#include "Physics.hpp" //Car stuff physics
#include "Particle.hpp" //Particle Stuff
#include "Timer.hpp" //Timer Stuff
#include "resource.h" //Windows and Dialoge Stuff
#define CameraSpeed 0.15f //Speed at which the floating camera moves
//**************************************WINDOWS STUFF*************************//
HWND hwnd = NULL; //handle to window
HMENU hMenu = NULL; //Handle to main window menu
HINSTANCE hInstance; //handle to instance of application
HDC hDC = NULL; //handle to Device Context
HGLRC hRC = NULL; //handle to Rendering Context;
RECT g_rRect;
//*******************************CLASS CREATIONG*****************************//
CCamera *g_Camera = NULL; //our camera!
g_Camera = new CCamera;
--------------------Configuration: Drag Race 2 - Win32 Debug--------------------
Compiling...
Main.cpp
Render.cpp
Linking...
Camera.obj : error LNK2001: unresolved external symbol "class CCamera g_Camera" (?g_Camera@@3VCCamera@@A)
Debug/Drag Race 2.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Drag Race 2.exe - 2 error(s), 0 warning(s)
extern CCamera* g_Camera; // Declaration
CCamera* g_Camera = NULL; // Definition
g_Camera = new CCamera; // Assignment / dynamic memory allocation
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more