Thread: Weird Errors

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    12

    Weird Errors

    Well, im trying to get full screen in console, but it doesnt seem to be working...

    Code:
    #include <iostream.h> //**REQUIRED TO WORK**
    
    int main() //**REQUIRED TO WORK**
    {
    
    	void fullscreen()          //another cool trick that I use to make it full screen or back to normal size
    
    	{
    
    	keybd_event(VK_MENU,0x38,0,0); //taken from cprogramming.com message board
    	keybd_event(VK_RETURN,0x1c,0,0);
    	keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
    	keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
    
    	}
    
    
    	char name1[15]
    	
    
    	cout<<"Hello World";
    	cout<<"What is your name?:";cin>>name1;
    	
    	
    	
    
    
    
    
    
    
    
    
    
    	return 0;
    }
    What seems to be wrong here? I get errors like...
    error C2601: 'fullscreen' : local function definitions are illegal and error C2146: syntax error : missing ';' before identifier 'cout'

    thanks,
    Gutty

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    The fullscreen( ) function has to be outside of main( ).
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    12
    Are you serious! Im embaressed... thanks.

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >>char name1[15]
    Forgot a semi-colon too.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    And, #include <windows.h>

    I think you need windows.h, because fullscreen() is not in iostream.h !

    And Gutty, please be more specific whth your titles... Like maybe "Weird error with fullscreen()" (See the Board Guidlines and Hints.)

  6. #6
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >>I think you need windows.h, because fullscreen() is not in iostream.h !
    If you had actually read the code, you would have realized that he has the code for fullscreen( ), but it is just inside of main( ).
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HELP with DX9 Errors!!!
    By Tommaso in forum Game Programming
    Replies: 7
    Last Post: 06-28-2006, 02:51 PM
  2. Errors with header files in OpenGL using VisualC++
    By wile_spice in forum Game Programming
    Replies: 3
    Last Post: 06-22-2006, 08:56 AM
  3. Weird Errors in VS 2003
    By Devil Panther in forum Windows Programming
    Replies: 1
    Last Post: 10-01-2005, 06:16 AM
  4. executing errors
    By s0ul2squeeze in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2002, 01:43 PM