1
\$\begingroup\$

I have some code that worked with no issues on MacOS Sierra, but when I update to Mojave, my compiler always says that it can't find SDL2.

Here's the error:

20:24:40 **** Incremental Build of configuration Debug for project Causality ****
make all 
Building file: ../src/engine/SE.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/engine/SE.d" -MT"src/engine/SE.o" -o "src/engine/SE.o" "../src/engine/SE.cpp"
In file included from ../src/engine/SE.cpp:1:
../src/engine/SE.h:6:10: fatal error: 'SDL2/SDL_events.h' file not found
#include <SDL2/SDL_events.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [src/engine/SE.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

20:24:42 Build Failed. 2 errors, 0 warnings. (took 1s.304ms)

I'm using SDL 2.0.9

My project structure is this:

src
|main.cpp
|engine
 |SE.h
 |SE.cpp
 |SE_Audio.h
 |SE_Audio.cpp
 |SE_Graphics.h
 |SE_Graphics.cpp
 |SE_Input.h
 |SE_Input.cpp
 |SE_Structs.h

I'm including the libraries with -framework SDL2 -framework Cocoa -framework SDL2_image

I'm using the exact same settings that I used before and that worked in MacOS Sierra. Please tell me what more details you need before down-voting

\$\endgroup\$
7
  • \$\begingroup\$ What SDL version are you using? It seems odd that updating your OS would break your include paths, but what does your project structure look like, and how are you specifying the include directories? \$\endgroup\$
    – user35344
    Nov 17 '18 at 9:59
  • \$\begingroup\$ @Tyyppi_77 Editted. \$\endgroup\$ Nov 17 '18 at 10:01
  • \$\begingroup\$ I feel like you might have better luck with this question on SO, since this seems more like a generic MacOS include framework issue than a game development / SDL specific thing. \$\endgroup\$
    – user35344
    Nov 17 '18 at 10:27
  • \$\begingroup\$ @Tyyppi_77 Maybe I should go on a Mac StackExchange if that exists. StackOverflow's community really doesn't help. \$\endgroup\$ Nov 17 '18 at 10:29
  • \$\begingroup\$ There is an Apple StackExchange, called Ask Different. However, their help center says "Code-level programming questions (cocoa, LLVM, etc…) are off-topic here. We do encourage AppleScript, Automator, and UNIX shell scripting questions as well as how to use tools like Xcode for non-language specific tasks." - so this might be borderline. I'd agree you'd probably get answers fastest on StackOverflow, just because they have more mac users frequenting the site than we do, through sheer volume. \$\endgroup\$
    – DMGregory
    Nov 17 '18 at 14:27
0
\$\begingroup\$

I've been on Mojave for a bit and haven't run into any compile issues with SDL2. I also do not use Xcode, but rather compile from the command line interface. In my call to g++ I include framework location with:

-F/Library/Frameworks -framework SDL2 -framework SDL2_image -framework SDL2_ttf -framework SDL2_mixer

Hope it helps.

\$\endgroup\$
0
\$\begingroup\$

I ended up just changing my IDE to Xcode and that somehow fixed it. Guess I'm using that now.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .