• 15
• 15
• 11
• 9
• 10

# Function not getting entered

This topic is 3896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Sorry about bad subject/title. My problem is that the function below (//HERE) is not getting entered:
RETURN_CODE game(Draw_Engine& DE, SDL_Event& event_)
{
Board board(DE, 8, 8);

while(true) {
if(!DE.Draw_Screen()) { //HERE
board.CleanUp(DE);
return EXIT_GAME;
}
if(board.DrawBoard(DE) == EXIT_GAME) {
board.CleanUp(DE);
return EXIT_GAME;
}
while(SDL_PollEvent(&event_)) {
if(event_.type == SDL_QUIT) {
board.CleanUp(DE);
return EXIT_GAME;
}
}
}
}


The functions definition looks like this:
bool Draw_Engine::Draw_Screen() {
return(SDL_Flip(screen) != -1);
}


When I'm debugging, and I try to step into the function (F11 with Visual Studio 2005 Version 8), it skips to the next line in the code. This also happens in another function:
RETURN_CODE Board::DrawBoard(Draw_Engine& DE)
{
/*
.O.O.O.O
O.O.O.O.
.O.O.O.O
. . . .
. . . .
X.X.X.X.
.X.X.X.X
X.X.X.X.
*/

DE.Blit_Image(board_image);

for(i = 0; i < p_pieces.size(); ++i) {
DE.Blit_Image(p_pieces.image);
}

for(i = 0; i < c_pieces.size(); ++i) {
DE.Blit_Image(c_pieces.image);
}

if(!DE.Draw_Screen()) { //HERE
return EXIT_GAME;
}

return SUCCESSFUL;
}


I'm clueless as to why this is happening. I questioned the return line in Draw_Screen, but it seems to be right. Can anyone shed some light? :D

##### Share on other sites
Are you compiling in Debug mode or Release mode? I'd guess the latter, in which case, the debugger lies in Release mode about where in your code the execution is happening because of code optimization.

-me

##### Share on other sites
Oh, god. Thanks for that!

Only problem is, I get this error:
Error	1	error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: class Piece & __thiscall std::vector<class Piece,class std::allocator<class Piece> >::operator[](unsigned int)" (??A?$vector@VPiece@@V?$allocator@VPiece@@@std@@@std@@QAEAAVPiece@@I@Z)	Board.obj

http://www.gamedev.net/community/forums/topic.asp?topic_id=456465. I gotta read that guy's replies... I haven't seen those replies yet.

##### Share on other sites
In debug mode, you need to link with debug libraries. I don't know what graphics library you are using, but it comes with debug libraries, so set up the configuration to use them.

-me

##### Share on other sites
The solution to the problem was:

Project > Properties > Configuration Properties > C/C++ > Code Generation > Runtime Library > Multi-threaded Debug DLL (/MDd)

and

Project > Properties > Configuration Properties > Linker > Input > Additional Dependencies > msvcrtd.lib

and

Project > Properties > Configuration Properties > Linker > Input > Ignore Specific Library > msvcrt.lib

Thanks.