Original Post
I am trying to load a .bmp image with SDL but i'm not sure were to put the image so it can be found. When I add the file in the project folder and run this code I get the following output in the console: /Users/user/Library/Developer/Xcode/DerivedData/SDLExperiment-dsfnjwhgojekaeehoaipimlpnoqb/Build/Products/Debug
The image could not be located due to the following error: Couldn't open hello.bmp
[color=#754a2b]
The image could not be located due to the following error: Couldn't open hello.bmp
[color=#754a2b]
#include <SDL.h>
#include <iostream>
using namespace std;
int main( int argc, char* args[] )
{
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;
char title[50] = "";
SDL_Init (SDL_INIT_EVERYTHING);
screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
hello = SDL_LoadBMP("hello.bmp");
if (hello == NULL)
{
cout << getcwd(title, 120) << endl;
cout << "The image could not be located due to the following error: "
<< SDL_GetError() << endl;
return 1;
}
SDL_BlitSurface(hello, NULL, screen, NULL);
SDL_Flip(screen);
SDL_Delay(2000);
SDL_FreeSurface(hello);
SDL_Quit();
return 0;
}