Thread: Allegro Problems with Visual C++ .net 2003

  1. #1
    Registered User LiNeAr's Avatar
    Join Date
    Aug 2005
    Posts
    31

    Allegro Problems with Visual C++ .net 2003

    HELLO!!!!! I am trying to get allegro to work with visual C++ .net, and i've been having some problems. I was following this tutorial HERE But the only error i got is at the very last line.....it says fatal error, and has something to do with the bracket at the very end. I have no clue what to do
    IDE: Microsoft Visual C++ .net Standard 2003

  2. #2
    Bioport Productions
    Join Date
    Oct 2005
    Posts
    215
    some code would be beneficial...
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:
    sadf 

  3. #3
    Registered User LiNeAr's Avatar
    Join Date
    Aug 2005
    Posts
    31
    Code:
    #include <allegro.h>
    
    
    int main(){
     
        allegro_init();
        install_keyboard();
        set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
        
        readkey();
        
        return 0;
        
    }   
    END_OF_MAIN();
                 <------------------it says the problem is here
    IDE: Microsoft Visual C++ .net Standard 2003

  4. #4
    Bioport Productions
    Join Date
    Oct 2005
    Posts
    215
    You got me..I don't know allegro. Your program looks compilable except for this line: END_OF_MAIN(); Is this a declaration? If it isn't shouldn't it be a part of main()?
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:
    sadf 

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    It is a macro that allegro uses. It does need to be there. But I don;t know enough about allegro to help either.

  6. #6
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Everything seems ok with that code.. Maybe post the exact error that you are getting.
    See if this will compile for you.
    Code:
    const int FAIL = -1
    const int SUCCESS = 0;
    
    int initAlleg()
    {
        allegro_init();    
        if(install_mouse() == -1)
        {
            allegro_message(allegro_error);
            return FAIL;
        }
        if(install_keyboard() < 0)
        {
            allegro_message(allegro_error);
            return FAIL;
        }
        if(install_timer() < 0)
        {
            allegro_message(allegro_error);
            return FAIL;
        }
        set_color_depth(16);
        if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0) != 0)
        {
            allegro_message(allegro_error);
            return FAIL;
        }    
        //set_window_title("Extreme Space");
        return SUCCESS;
    }
    
    int main()
    {
        initAlleg();
    }
    END_OF_MAIN()
    Last edited by prog-bman; 10-13-2005 at 08:34 PM.
    Woop?

  7. #7
    Registered User
    Join Date
    Oct 2005
    Posts
    6
    Quote Originally Posted by LiNeAr
    Code:
    #include <allegro.h>
    
    
    int main(){
     
        allegro_init();
        install_keyboard();
        set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
        
        readkey();
        
        return 0;
        
    }   
    END_OF_MAIN();
                 <------------------it says the problem is here

    I think your problem is this.
    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
    It should either be this
    set_gfx_mode( GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
    Or this.
    set_gfx_mode( GFX_AUTODETECT_FULLSCREEN, 640, 480, 0, 0);
    Hope that helps!!

  8. #8
    ---
    Join Date
    May 2004
    Posts
    1,379
    Well it's kinda hard to guess what the error message actually is. Maybe the OP should show us.

  9. #9
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Quote Originally Posted by Breander
    I think your problem is this.
    It should either be this
    *snip*
    Or this.
    *snip*
    Hope that helps!!
    As I said before that is valid code he just needs to post the error s/he is getting.
    Woop?

  10. #10
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    Here is the error I always get: fatal error C1010: unexpected end of file while looking for precompiled header directive

  11. #11
    Registered User
    Join Date
    Oct 2005
    Posts
    6
    Quote Originally Posted by prog-bman
    As I said before that is valid code he just needs to post the error s/he is getting.
    Your right I didnt try compiling the code earlier but I did and it works fine for me.

    The only thing that I can think of is that allegro wasn't compiled correctly for Visual C++.

  12. #12
    Railgun God |Wiz|'s Avatar
    Join Date
    Sep 2005
    Posts
    23
    Maybe add a "#include "stdafx"" ALL THE WAY at the beginning if its not there. The compiler requires it.

  13. #13
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    You can turn off precompiled headers you don't need that for what you are doing. Or you can do what |Wiz| said he seems semi smart .
    Woop?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  3. MS Visual C++ 6 wont include vector.h in a header file
    By bardsley99 in forum C++ Programming
    Replies: 9
    Last Post: 11-06-2003, 12:05 PM
  4. compile c programs with visual studio .net 2003
    By kashifk in forum C Programming
    Replies: 4
    Last Post: 10-11-2003, 09:37 PM
  5. Visual C++ .NET 2003 and XP Style
    By kuphryn in forum Windows Programming
    Replies: 1
    Last Post: 10-07-2003, 11:08 AM