Hi,
Here's my problem:
I'm trying to make a set of constants that will be used by my entire program. So, I made a separate class called CPCons that houses all of the static constants. Like so:
Code:
//CPCons.C
class CPCons{
public:
static double unitLength;
static double gapSpace;
static int tilesPerColumn;
static int tilesPerRow;
static int oldXLoc;
static int oldYLoc;
static int newXLoc;
static int newYLoc;
//Camera Variables
static float cameraXValue;
static float cameraYValue;
static float cameraZValue;
static float totalCameraDistance;
static float cameraElevationAngle;
static float cameraTwistAngle;
static float maxSeeingDistance;
};
Then, inside of another file:
Code:
//Main file, whatever...
#include "CPCons.C"
int main(int argc, char** argv){
/*INITIALIZE THE CONSTANTS!!!!!! */
CPCons::unitLength = 3.0;
CPCons::gapSpace = 0.3;
CPCons::tilesPerColumn = 6;
CPCons::tilesPerRow = 10;
CPCons::oldXLoc = 0;
CPCons::oldYLoc = 0;
CPCons::newXLoc = 0;
CPCons::newYLoc = 0;
//Camera Variables
CPCons::cameraXValue = 0;
CPCons::cameraYValue = 0;
CPCons::cameraZValue = 50.0;
CPCons::totalCameraDistance = 50.0;
CPCons::cameraElevationAngle = 40.0;
CPCons::cameraTwistAngle = - 90.0;
CPCons::maxSeeingDistance = 100.0;
}
I get a linker error saying:
warning: prebinding was disabled because of undefined symbols.
Undefined Symbols:
Here's wha the build log says:
/usr/bin/jam -d1 JAMBASE=/Developer/Makefiles/pbx_jamfiles/ProjectBuilderJambase JAMFILE=- build ACTION=build _DEFAULT_GCC_VERSION=3.1 BUILD_STYLE=Development "CPP_HEADERMAP_FILE=/Users/gtaubman/Desktop/CheesyPursuit/build/Cheesy Pursuit.build/Cheesy Pursuit.build/Cheesy Pursuit.hmap" SRCROOT=/Users/gtaubman/Desktop/CheesyPursuit OBJROOT=/Users/gtaubman/Desktop/CheesyPursuit/build SYMROOT=/Users/gtaubman/Desktop/CheesyPursuit/build "DSTROOT=/tmp/Cheesy Pursuit.dst"
...updating 11 target(s)...
Cp /Users/gtaubman/Desktop/CheesyPursuit/build/Cheesy Pursuit.app/Contents/PkgInfo
BuildPhase <CopyResources>Cheesy Pursuit.app
Completed phase <CopyResources> for <CopyResources>Cheesy Pursuit.app
CompileCplusplus /Users/gtaubman/Desktop/CheesyPursuit/build/Cheesy Pursuit.build/Cheesy Pursuit.build/Objects-normal/ppc/CMain.o
BuildPhase <DeriveAndCompileSources>Cheesy Pursuit.app
Completed phase <DeriveAndCompileSources> for <DeriveAndCompileSources>Cheesy Pursuit.app
MasterObjectFile.Combine /Users/gtaubman/Desktop/CheesyPursuit/build/Cheesy Pursuit.build/Cheesy Pursuit.build/Objects-normal/ProjectBuilderMasterObjectFile.o
StandaloneExecutable /Users/gtaubman/Desktop/CheesyPursuit/build/Cheesy Pursuit.app/Contents/MacOS/Cheesy Pursuit
ld: warning prebinding disabled because of undefined symbols
ld: Undefined symbols:
CPCons::unitLength
CPCons::tilesPerRow
CPCons::cameraXValue
CPCons::cameraYValue
CPCons::cameraZValue
CPCons::tilesPerColumn
CPCons::cameraTwistAngle
CPCons::maxSeeingDistance
CPCons::totalCameraDistance
CPCons::cameraElevationAngle
CPCons::newXLoc
CPCons::newYLoc
CPCons::oldXLoc
CPCons::oldYLoc
CPCons::gapSpace
/usr/bin/g++3 -o "/Users/gtaubman/Desktop/CheesyPursuit/build/Cheesy Pursuit.app/Contents/MacOS/Cheesy Pursuit" "-L/Users/gtaubman/Desktop/CheesyPursuit/build" "-F/Users/gtaubman/Desktop/CheesyPursuit/build" -filelist "/Users/gtaubman/Desktop/CheesyPursuit/build/Cheesy Pursuit.build/Cheesy Pursuit.build/Objects-normal/LinkFileList" "-arch" "ppc" "-prebind" "-framework" "OpenGL" "-framework" "GLUT" "-lobjc" "-framework" "OpenGL" "-framework" "GLUT"
...failed StandaloneExecutable.LinkUsingFileList /Users/gtaubman/Desktop/CheesyPursuit/build/Cheesy Pursuit.app/Contents/MacOS/Cheesy Pursuit ...
Any ideas? I'm completely stumped. It all compiles fiine up to there. It seems like .o files aren't getting linked together, or something stupid. I just can't find the problem. Any help would be appreciated. Thanks again.
Gabe