On Sep 23, 2007, at 9:37 PM, Chris Espinosa wrote:
On Sep 23, 2007, at 8:24 PM, Adam wrote: Ok I don't know the context of the error (I linked to the code, so that may help). It doesn't tell me where the error is taking place (because it's not specific to one of the lines. Here is the error:
<big long string>
Ok I see what you mean now. I don't know how it can say that though, because I checked on some of these things, and I didn't define any of these symbols in tile_init_001.cpp like it says I did. So what does it mean?
It means you're defining a variable in a header file, and then including that header file from three source files, so you end up defining it three times. And you're doing this for three globals, so you get nine errors.
Move your definitions to one and only one .cpp file.
Chris
...but I have #pragma once at the top! Doesn't that pretty much fix the problem? I used Cris Suter's advice and slapped an "extern" on the ones that it said were having a problem, and bingo! it's fixed. The only thing now is that it's giving me warnings about some bool functions that I have:
cd "/Users/atg/Desktop/Projects/Programming Project/Builds/Basic_SDLOGL_001" /usr/bin/gcc-4.0 -x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -g -O0 -fmessage-length=0 -mtune=G4 -fvisibility-inlines-hidden -I/Users/atg/Desktop/Projects/Xcode\ Projects/Basic_SDLOGL_001.build/Deployment/Basic_SDLOGL_001\ (Upgraded).build/Basic_SDLOGL_001.hmap -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -mdynamic-no-pic -F/Users/atg/Desktop/Projects/Xcode\ Projects/Deployment -F/Library/Frameworks -I/Users/atg/Desktop/Projects/Xcode\ Projects/Deployment/include -I/Library/Frameworks/SDL.framework/Headers -I/Users/atg/Desktop/Projects/Xcode\ Projects/Basic_SDLOGL_001.build/Deployment/Basic_SDLOGL_001\ (Upgraded).build/DerivedSources -c /Users/atg/Desktop/Projects/Programming\ Project/Builds/Basic_SDLOGL_001/Sources/sdl_tetris_002.cpp -o /Users/atg/Desktop/Projects/Xcode\ Projects/Basic_SDLOGL_001.build/Deployment/Basic_SDLOGL_001\ (Upgraded).build/Objects-normal/ppc/sdl_tetris_002.o /Users/atg/Desktop/Projects/Programming Project/Builds/Basic_SDLOGL_001/Sources/sdl_tetris_002.cpp: In function 'void event_loop()': /Users/atg/Desktop/Projects/Programming Project/Builds/Basic_SDLOGL_001/Sources/sdl_tetris_002.cpp:111: warning: the address of 'bool tile_down()', will always evaluate as 'true' /Users/atg/Desktop/Projects/Programming Project/Builds/Basic_SDLOGL_001/Sources/sdl_tetris_002.cpp:140: warning: the address of 'bool tile_down()', will always evaluate as 'true' /Users/atg/Desktop/Projects/Programming Project/Builds/Basic_SDLOGL_001/Sources/sdl_tetris_002.cpp:153: warning: the address of 'bool tile_left()', will always evaluate as 'true' /Users/atg/Desktop/Projects/Programming Project/Builds/Basic_SDLOGL_001/Sources/sdl_tetris_002.cpp:161: warning: the address of 'bool tile_right()', will always evaluate as 'true'
Here's the code:
bool collision_check() { //if something's in the way return false otherwise return true }
bool tile_down() { next_piece = curr_piece; next_piece.y--; if (!collision_check()) { return false; }else { return true; } }
If collision_check returns false then tile_down should also return false! ... right?
Adam |