Linker errors with static abstract class...

This is a discussion on Linker errors with static abstract class... within the C++ Programming forums, part of the General Programming Boards category; I never understood that error message until now. Thanks Elysia!...

  1. #16
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    I never understood that error message until now.

    Thanks Elysia!
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  2. #17
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,663
    You're welcome
    Btw, it doesn't have to be a function. It can also be a variable, as you just witnessed. But it's the same in that it wasn't able to find it!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    Also, if you're all curious, I'm working on getting rid of this mess:

    Code:
    void Card_Game::play_game()
    {
    	using namespace std;
    	int gameloop = 1;
    	int result = 0;
    	int controller = 0;
    	
    	while (gameloop != 0)
    	{
    		IO::instance().clear_screen();
    		switch(controller)
    		{
    		case 0: // main menu
    			std::cout << "Welcome to the Casino!\n";
    			std::cout << "What would you like to do?\n";
    			std::cout << "1. Play Blackjack\n";
    			std::cout << "2. Quit\n";
    			result = IO::instance().get_input();
    			controller = main_menu(result);
    			if (controller == 4)
    			{
    				gameloop = 0; // end game
    			}
    			break;
    		case 1:	// blackjack function
    			cout << players[0].show_hand();
    			std::cout << players[1].show_hand();
    			std::cout << "The current jackpot is " << pot->get_pot() << " dollars!\n";
    			std::cout << "\nWhat would you like to do?\n";
    			std::cout << "1. Hit me\n";
    			std::cout << "2. Stay\n";
    			std::cout << "3. Fold\n";
    			result = IO::instance().get_input();
    			controller = blackjack(result);
    			break;
    		case 2: // deal again?
    			for (unsigned int loop = 0; loop < players[0].hand->card_list.size(); loop++)
    			{
    				players[0].hand->card_list[loop].flip_card(true);
    			}
    			std::cout << players[0].show_hand();
    			std::cout << players[1].show_hand();
    			if (player_wins == true)
    			{
    				std::cout << "You win!!\n"
    						  << "You've won " 
    					      << calculate_winnings()
    						  << " dollars!\n\n";
    				players[1].cash += calculate_winnings();
    			}
    			else
    			{
    				std::cout << "You Lose!!\n"
    					      << "You've lost "
    						  << pot->get_pot()
    						  << " dollars!\n\n";
    			}
    			std::cout << "Would you like to deal again?\n";
    			std::cout << "1. Yes\n";
    			std::cout << "2. No\n";
    			result = IO::instance().get_input();
    			controller = deal_again(result);
    			break;
    		case 3: // place bets
    			std::cout << players[0].show_hand();
    			std::cout << players[1].show_hand();
    			std::cout << "How much would you like to bet?  You have "
    				      << players[1].cash
    					  << " dollars.\n";
    			controller = place_bets(IO::instance().get_input());
    			if (controller == 4)
    			{
    				controller = 3;
    			}
    			break;
    		}
    	}
    }
    I've decided to do some research on gamestates and I figure that I could easily simplify my code to something like this:

    Code:
    int main ( int argc, char *argv[] )
    {
      State_Manager state_manager;
    
      // initialize the engine
      state_manager.init();
    
      // load the intro
      state_manager.change_state( Menu_State::instance() );
    
      // main loop
      while ( state_Manager.running() )
      {
        state_manager.update();
        state_manager.draw();
        state_manager.handle_events();
    
      }
    
      // cleanup the engine
      state_manager.cleanup();
      return 0;
    }
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  4. #19
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,663
    Wonders of classes, no?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    YES, it's quite amazing, thats why I'm trying to make this work though, because the result is something close to perfection bwahhaha
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking errors with static var
    By Elysia in forum C++ Programming
    Replies: 8
    Last Post: 10-27-2007, 05:24 PM
  2. deriving classes
    By l2u in forum C++ Programming
    Replies: 12
    Last Post: 01-15-2007, 04:01 PM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 10:03 PM
  4. Static variables and functions problem in a class
    By earth_angel in forum C++ Programming
    Replies: 16
    Last Post: 09-15-2005, 12:08 PM
  5. linker error, using static member
    By Chiel in forum C++ Programming
    Replies: 6
    Last Post: 06-28-2003, 08:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21