JMU JMU - Department of Computer Science
Help Tools
Creating a GLUT Project in Xcode


1 Introduction

Xcode is a project-based IDE. That is, it assumes that you are working on a project of some kind, not an individual class or file. When creating a project you must specify various properties of the project. This document describes how to create an Xcode (v 4.6) project that uses OpenGL and GLUT.

2 Steps in the Process

After starting Xcode you should:
  1. Click on File on the main menu and pull down to New and Project....
  2. When you are prompted to "Choose a template" select "Cocoa Application" and click on Next.
  3. Enter a "Product Name" (e.g., GLUTtest).
  4. Uncheck all options (e.g., Uncheck "Use Core Daya", "Use Automatic reference Counting", "Include Unit Tests", etc...).
  5. Click on Next.
  6. Select an appropriate directory/folder for the project and click on Create.
  7. Click on the Folder icon near the top left of the window (in case it isn't already selected).
  8. Click on the Project icon (e.g., GLUTtest) underneath the Folder icon (in case it isn't already selected).
  9. Delete (i.e., move to the trash) everything from the main folder (e.g., AppDelegate.h, AppDelegate.m, and MainMenu.xib.
  10. Delete (i.e., move to the trash) everything from the "Supporting Files" folder.
  11. Click on the "Build Settings" tab (in case it isn't already selected).
  12. Under "Build Settings", in the "Packaging" section, make the "Info.plist File" field empty (i.e., select the text in the field and delete it).
  13. Under "Build Settings" do one or the other of the following:
    1. In the "Apple LLVM Compiler" section make the "Prefix Header" blank.
    2. In the "User Defined" section make the "GCC Prefix Header" blank.
  14. Summary - Linked Frameworks and Libraries Click on the + Click on Add Other Navigate to and select /Library/Frameworks/SDL2.framework Build Settings - Search Paths - Add /Library/Frameworks to the Framework Search Paths
  15. Click on the "Summary" tab.
  16. Click on the + in the "Linked Frameworks and Libraries" section.
  17. Click on Add Other....
  18. Navigate to and select /Library/Frameworks/SDL2.framework.
  19. Click on the "Build Settings" tab.
  20. In the "Search Paths" section enter /Library/Frameworks in the "Framework Search Paths" field.

Note that you may want to or need to run SDL on top of OpenGL. In this case, you will also need to:

  1. Click on the + in the "Linked Frameworks and Libraries" section.
  2. Scroll down to and click on "GLUT.framework".
  3. Click on Add.
  4. Click on the + in the "Linked Frameworks and Libraries" section.
  5. Scroll down to and click on "OpenGL.framework".
  6. Click on Add.

3 Testing Your Installation

You can use the following small program (named test.c) to test your installation:
sdlexamples/test.c

Note that you may need to change the #include directive in this example.

To create a file in your project, click on File on the main menu and pull down to New and File..., select the "C File", and click on Next.

To compile and execute the program, click on Product on the main menu and pull down to Run.

Copyright 2019