XCode 10 / MacOS 10.14 instructions

uem_s03_building_spacewar_in_xcode

#1

When building with the new XCode 10 (on MacOS 10.14 even) you’ll get these build issues:

-fobjc-weak is not supported on the current deployment target

I couldn’t find a target does support it, so the easiest thing is to just turn off weak.

  1. Click the Project in the top left (steamworksexample)
  2. Choose the steamworksexample target (with the colored A shaped icon, not the blue one)
  3. Choose “build settings”
  4. Type “weak” in the search box.
  5. Change “Weak References in Manual Retain Release” to “No” (they’re not really using ObjC anyway)


(:drooling_face: mmm that sweet dark theme)

The next error you should get is:

mathlite.h:128:14: error: ‘sqrt’ is missing exception specification ‘noexcept’

This is on a function called FastSqrt, if you add noexcept it then says that sqrt is redefined. To solve this, just let OSX use it’s “slow” sqrt function.

  1. Open the file Source/glmgr/mathlite.h
  2. Comment out line 20 so it looks like this: “// #define FastSqrt(x) sqrt(x)”

That fixed all the errors for me!


#2

You could even #undef sqrt if you really think it’s going to matter for perf.

I’ve read the “black book” (https://www.amazon.com/Michael-Abrashs-Graphics-Programming-Special/dp/1576101746) and one thing he drilled into my head, is that you should fix things that are actually slow, not that could be slow if abused. Don’t over optimize.


#3

Absolutely!


#4

Hello,

I was following these instructions but before I ever got the “mathlite.h” error, I instead got an error saying “‘string’ not found”. Oddly, it looks like stdafx.h #includes “<string.h>” and “”.

If anyone else finds a solution to this error, it would be appreciated.

Using Xcode 10 on macOS Mojave.

Cheers.