Hi!.. Question about loading BMP


I´m very very new to SDL2 (just started yesterday), I was following a tutorial but at the loading BMP time, I got some problems, my attached picture is self-explanatory.

I have a “hello.bmp” image file on the same path as my “main.cpp” source file, but when I build it (using Xcode) I got the error that could not load the file, I don’t know if this is “not found” or " file is corrupt?" related, I doubt the first one, since I can open the bmp file in Gimp with no problem.

Hi res reference picture:

Any help will be appreciated.

After running SDL_LoadBMP, you can call SDL_GetError to see the reason why it failed.

Not sure how your IDE handles pathing, but your BMP will need to be in the same location as the executable; my guess would be your Products folder. Just a guess at this point as I’ve never programmed for a Mac before and don’t have one to test anything out on.

1 Like

On Xcode the structure of where your files are on the project manager pane doesn’t bear any resemblance to where the files are actually located on your hard disk.

Use Finder to go look at where your .bmp file is actually located. For my MacOS SDL projects I have them in the same base folder where the .xcodeproj file is stored. Maybe try moving your .bmp file there?

1 Like

thanks so much for both replies, i will check path and copying the bmp file to structure root folder.