Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Dev c++ is attempting to compile a different function to the one in the code

Help
Hazza
2013-05-01
2013-05-01
  • Hazza
    Hazza
    2013-05-01

    So basically...

    Here is a very simplified version of main() without the clutter.. if you think you need to see the rest of the source code, just ask :)

    include "SDL/SDL.h"

    include "stdlib.h"

    include "Image_Utilities.h"

    using namespace std;

    SDL_Surface* BackgroundSprite;

    int main (int argc, char* argv[])
    {

    BackgroundSprite = LoadImage("Resources//Background.png");
    
    Clean_Up();
    return 0;
    

    }

    The function LoadImage is in Image_Utilities.h and is shown below..

    SDL_Surface LoadImage( std::string S_FileName )
    {
    //The image that's loaded
    SDL_Surface
    SS_LoadedImage = NULL;

    //The optimized surface that will be used
    SDL_Surface* SS_OptimizedImage = NULL;
    
    //Load the image
    SS_LoadedImage = IMG_Load( S_FileName.c_str() );
    
    //If the image loaded
    if( SS_LoadedImage != NULL )
    {
        //Create an optimized surface
        SS_OptimizedImage = SDL_DisplayFormat( SS_LoadedImage );
    
        //Free the old surface
        SDL_FreeSurface( SS_LoadedImage );
    
        //If the surface was optimized
        if( SS_OptimizedImage != NULL )
        {
            //Color key surface
            SDL_SetColorKey( SS_OptimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB( SS_OptimizedImage->format, 0, 0xFF, 0xFF ) );
        }
    }
    
    //Return the optimized surface
    return SS_OptimizedImage;
    

    }

    But when I compile, I get this error:

    In function int SDL_main(int, char**)': cannot convertconst char' to HINSTANCE__*' for argument1' to `void LoadImageA(HINSTANCE__, const CHAR, UINT, int, int, UINT)'

    Something about LoadImageA? I dont have a LoadImageA... I played around with namespaces.. trying to get it to use my userdefined namespace but it threw up errors about not finding LoadImageA, any help will be much appeciated!

    Thanks