We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3832 - [PATCH] Compilation error with "IMG_jpg.c" on Mac OS X
Summary: [PATCH] Compilation error with "IMG_jpg.c" on Mac OS X
Status: RESOLVED FIXED
Alias: None
Product: SDL_image
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.1
Hardware: x86_64 Mac OS X 10.11
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-18 15:20 UTC by Holger Schemel
Modified: 2017-09-18 23:07 UTC (History)
0 users

See Also:


Attachments
patch (602 bytes, patch)
2017-09-18 15:20 UTC, Holger Schemel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Schemel 2017-09-18 15:20:37 UTC
Created attachment 2948 [details]
patch

Summary: Error when compiling file "IMG_jpg.c" on Mac OS X.

This compilation error may possibly only occur in certain cases (maybe depending on what "./configure" detected); however, it will always occur if the first "#if" (at the very top of the file) results in the corresponding #if/#endif block to be skipped.

In this case, the remaining part of the source file (starting with "#define SAVE_JPG" / "#ifdef SAVE_JPG") will always be compiled, but has no SDL stuff defined (like "SDL_Surface" etc.), because "SDL_image.h" was never included in this case, and will therefore fail with a compiler error.

The attached patch simply moves that first "#if" below the "#include"s, which fixes the problem.
Comment 1 Sam Lantinga 2017-09-18 23:07:32 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL_image/rev/90b2de23ea5e
Comment 2 Sam Lantinga 2017-09-18 23:07:49 UTC
This is now fixed.