C++ with SDL2 Framework: Loading .bmp files in same folder in XCode 5

I am trying to load a .bmp file located in the same folder as main.cpp etc. but I'm not sure what to input as the resource path so that it picks it up and, when I distribute it, I want it to be preferably cross platform and run smoothly.

I have tried using:
hello_world.bmp
SDL_Game/hello_world.bmp (SDL_Game is the name of the project)

but it will work if I use the full path. I don't want to do this though, because then it will not work on other computers and platforms.

This is the function I use to load media:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
bool loadMedia()
{
    // Loading success flag
    bool success = true;
    
    // Load splash image
    gHelloWorld = SDL_LoadBMP("hello_world.bmp");
    if (gHelloWorld == NULL)
    {
        printf("Unable to load image %s! SDL Error: %s\n", "SDL_Game/hello_world.bmp", SDL_GetError());
        success = false;
    }
    
    return success;
}


I am using XCode 5, SDL2.0.1, OSX 10.9 Mavericks and C++.
closed account (N36fSL3A)
Try putting the image in the same directory as the executable.
After a very long time, it now works. I have to link it with xcode and put in a specific folder.

Works now.
Topic archived. No new replies allowed.