   Problems with #include, my header files and the linker
  As some of you know from my recent problems, I have started making a Pong clone in SDL. I''ve got a good precentage of it done right now and I''m moving on to the physics.Only 4 lines into CPhysics.h, I include "Common.h" which has the following declarations in it:   // Common.h#ifndef COMMON_H#define COMMON_H/////////////// INCLUDES ///////////////#include <sdl.h>#include <stdlib.h>#include <stdio.h>#include "CGame.h"#include "CPhysics.h"/////////////// DEFINES ////////////////#define PADDLE_1_XPOS20#define PADDLE_1_YPOS150#define PADDLE_2_XPOS600#define PADDLE_2_YPOS150#define BALL_X_POS300#define BALL_Y_POS180#define BALL_X_VEL2#define BALL_Y_VEL2/////////////// GLOBALS ////////////////extern CPaddle g_Player1(PADDLE_1_XPOS, PADDLE_1_YPOS);// Player 1''s paddleextern CPaddle g_Player2(PADDLE_2_XPOS, PADDLE_2_YPOS);// Player 2''s paddleextern CBall g_Ball(BALL_X_POS, BALL_Y_POS,  static_cast<int>(BALL_X_VEL),  static_cast<int>(BALL_Y_VEL));  // The game ballCGame g_Game;#endif  COMMON_HAnd when I compile, I get these errors:   Generating Code...Linking...CPhysics.obj : error LNK2005: "class CPaddle g_Player1" (?g_Player1@@3VCPaddle@@A) already defined in main.objCPhysics.obj : error LNK2005: "class CBall g_Ball" (?g_Ball@@3VCBall@@A) already defined in main.objCPhysics.obj : error LNK2005: "class CGame g_Game" (?g_Game@@3VCGame@@A) already defined in main.objCPhysics.obj : error LNK2005: "class CPaddle g_Player2" (?g_Player2@@3VCPaddle@@A) already defined in main.objIf yoiu want to look at about my 550 lines of source, you can download it at  my website . I don''t know what''s wrong, I hate when I get these linker errors.If I take out the include in CPhysics, I don''t get the error but then I can''t do what I would like to because I have a few globals and I don''t like to use parameters when working with physics.   R.I.P. Mark OsbackSolo Pa Mi GenteVG-Force
 extern CPaddle g_Player1(PADDLE_1_XPOS, PADDLE_1_YPOS); // Player 1's paddleextern CPaddle g_Player2(PADDLE_2_XPOS, PADDLE_2_YPOS); //Player 2's paddleextern CBall g_Ball(BALL_X_POS, BALL_Y_POS,  static_cast<int>(BALL_X_VEL),  static_cast<int>(BALL_Y_VEL));  // The game ballCGame g_Game;This shoudn't be in an .H file !Move your extern defs in the .CPP file you need them to be.   [edited by - Pro-XeX on February 10, 2004 7:45:22 PM] [edited by - Pro-XeX on February 10, 2004 7:46:17 PM];  Still no go, somebody please help. Keep me from using parameters and stuff!   R.I.P. Mark OsbackSolo Pa Mi GenteVG-Force;  Just give the names in the header:extern type_1 name_1;extern type_2 name_2;And then in the actual cpp then put the arguments for the constructor:type_1 name_1(argument_1, argument_2, ...);type_2 name_2(argument_3, argument_4, ...);In your case, put:extern CPaddle g_Player1;extern CPaddle g_Player2;extern CBall g_Ball;extern CGame g_Game;in the header, and put:CPaddle g_Player1(PADDLE_1_XPOS, PADDLE_1_YPOS);CPaddle g_Player2(PADDLE_2_XPOS, PADDLE_2_YPOS);CBall g_Ball(BALL_X_POS, BALL_Y_POS,  static_cast(BALL_X_VEL),  static_cast(BALL_Y_VEL));CGame g_Game;in the cpp (that''s your stuff with the "externs" removed);  Thanks a bunch man, that helped so much.   R.I.P. Mark OsbackSolo Pa Mi GenteVG-Force