Can't build Lazy Foo's Source for Lesson 1 in XCode

I have just started to use SDL2 and right now, I have trouble setting it up. Right now, I am using Lazy Foo’s tutorial for setting up:

Everything has been going pretty smoothly until I hit step 7 of his tutorial, in which I was able to download his source file for lesson one and put it into my project. However, whenever I tried to build, I get six documentation issues and one Apple Mach-O Linker (Id) error.

One documentation issue is occuring in the SDL_assert.h, four documentation issues are occuring in SDL_rwops.h, and one documentation issue is occuring in SDL_hints.h. Here is an image of the errors I am receiving (Sorry, but apparently, I can only post one image since I am a new user, so I will try to post the second image in the comments):

In addition, all of the document issues are occuring all in the same line:
#include <SDL2/SDL.h>

This is my first time posting here, so if I missed out on any crucial details, please tell me so that I can rectify it.

Here is the second image of the documentation issues and Apple Mach-O Linker (Id) error:

Hi, the linker error is missing, can you try right-clicking on the “Linker command failed with exit code” and select “Reveal in Log”? Xcode should show a more detailed error in the main pane of the window.

Here is the log reveal:

Looks like the linker error is from having two main functions. There’s one in 01_hello_SDL.cpp and one in main.cpp (guessing the extension). If main.cpp is the “Hello world” program that Xcode generates, that’s the problem - just remove main.cpp from your project or delete everything in that file.

1 Like

Looks like taking out the main.cpp solved my issue. Interesting note, however, is that the documentation issues still persist even though my build succeeded. Does this mean I can safely ignore these issues?

Great! Yes, I think you can safely ignore those, they seem to be style suggestions about the SDL documentation.

Thank you so much for the help!

1 Like