2013-07-19 2 views
-1

입니다. 코드의 int main() 세그먼트에서 식별자 (타일)를 선언했습니다. 어떤 라인에서는 식별자가 선언되지 않았다고 생각하고, 다른 라인에서는 선언을 인식합니다. 초기 선언은 모든 대괄호 (메인을 제외한) 밖입니다. 이것은 왜 발생 하는가? 또는 내 오류 코드는 줄 곳 그건 적어도 -식별자가 선언 된 부분과 선언되지 않은 부분이 모두 C2065 VS2010 C++

int main(int argc, char* args[]) 
{ 
//Quit flag 
bool quit = false; 

//The dot 
Dot myDot; 

//The tiles that will be used 
Tile *tiles[ TOTAL_TILES ]; 

//The frame rate regulator 
Timer fps; 

//Initialize 
if(init() == false) 
{ 
    return 1; 
} 

//Load the files 
if(load_files() == false) 
{ 
    return 1; 
} 

//Clip the tile sheet 
clip_tiles(); 

//Set the tiles 
if(set_tiles(tile) == false) 
{ 
    return 1; 
} 

//While the user hasn't quit 
while(quit == false) 
{ 
    //Start the frame timer 
    fps.start(); 

    //While there's events to handle 
    while(SDL_PollEvent(&event)) 
    { 
     //Handle events for the dot 
     myDot.handle_input(); 

     //If the user has Xed out the window 
     if(event.type == SDL_QUIT) 
     { 
      //Quit the program 
      quit = true; 
     } 
    } 

    //Move the dot 
    myDot.move(tiles); 

    //Set the camera 
    myDot.set_camera(); 

    //Show the tiles 
    for(int t = 0; t < TOTAL_TILES; t++) 
    { 
     tiles[ t ]->show(); 
    } 

    //Show the dot on the screen 
    myDot.show(); 

    //Update the screen 
    if(SDL_Flip(screen) == -1) 
    { 
     return 1; 
    } 

    //Cap the frame rate 
    if(fps.get_ticks() < 1000/FRAMES_PER_SECOND) 
    { 
     SDL_Delay((1000/FRAMES_PER_SECOND) - fps.get_ticks()); 
    } 
} 

//Clean up 
clean_up(tile); 

return 0; 
} 

내 문제는 clean_up (tile);set_up (tile); 함께.

+0

오류 메시지/스택 추적을 포함 – eebbesen

답변

2

tiletiles은 동일한 식별자가 아닙니다.

+0

와우 나는 바보처럼 느낍니다. 좋은 눈! – user2601168

+0

관련이 없지만 일단 오타를 수정하면 set_tiles() 및 clean_up() 함수가 1 개의 인수를 사용하지 않는다는 또 다른 오류가 발생합니다. – user2601168

+0

@ user2601168 그래서 ... 더 많은 인수를 전달합니까? 표준 C++이 아니기 때문에'set_tiles'와'clean_up'이 무엇인지 전혀 알지 못합니다. – Casey