Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OpenGL example from SFML and macOS Mojave  (Read 1996 times)

0 Members and 1 Guest are viewing this topic.

Faberge

  • Newbie
  • *
  • Posts: 2
  • Right here, right now
    • View Profile
OpenGL example from SFML and macOS Mojave
« on: November 15, 2018, 01:37:46 pm »
So, I recently encountered a problem that OpenGL example that comes with SFML package can no longer be compiled after upgrade to Mojave 14.1. The thing is, since OpenGL is deprecated in Mojave (why Apple, why?!.) the example no longer works as it is now (I compiled it before, with High Sierra). The compiler first ask to define a macro:

#ifndef GL_SILENCE_DEPRECATION
#define GL_SILENCE_DEPRECATION
#endif


With this, you can compile the cpp file without warnings but when it comes to linker, then there is an error message:

Quote
Undefined symbols for architecture x86_64:
  "_glClear", referenced from:
      _main in SFML-8f1fd1.o
  "_glClearDepth", referenced from:
      _main in SFML-8f1fd1.o
  "_glDepthMask", referenced from:
      _main in SFML-8f1fd1.o
  "_glDisable", referenced from:
      _main in SFML-8f1fd1.o
  "_glDisableClientState", referenced from:
      _main in SFML-8f1fd1.o
  "_glDrawArrays", referenced from:
      _main in SFML-8f1fd1.o
  "_glEnable", referenced from:
      _main in SFML-8f1fd1.o
  "_glEnableClientState", referenced from:
      _main in SFML-8f1fd1.o
  "_glFrustum", referenced from:
      _main in SFML-8f1fd1.o
  "_glLoadIdentity", referenced from:
      _main in SFML-8f1fd1.o
  "_glMatrixMode", referenced from:
      _main in SFML-8f1fd1.o
  "_glRotatef", referenced from:
      _main in SFML-8f1fd1.o
  "_glTexCoordPointer", referenced from:
      _main in SFML-8f1fd1.o
  "_glTranslatef", referenced from:
      _main in SFML-8f1fd1.o
  "_glVertexPointer", referenced from:
      _main in SFML-8f1fd1.o
  "_glViewport", referenced from:
      _main in SFML-8f1fd1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What to do, as I am just out of ideas now.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: OpenGL example from SFML and macOS Mojave
« Reply #1 on: November 15, 2018, 02:34:46 pm »
Does SFML Graphics (sf::RenderWindow, sf::Sprite, sf::Texture, etc.) itself work? It uses OpenGL (like glClear that is listed as missing in your error) too. If so then OpenGL is not gone yet and you can try to find out how to get it to work but it'll not last long into the future.

Maybe Angle or Molten can help with that going forward.

Apple removing OpenGL in favor of their own API instead of Vulkan is not really that surprising. They always do their own thing and go over stuff like a road roller but their customers seem to love it and pay a slight premium for it. And wasn't it already limited by OS X to only maximum of GL 4.1 or something like that for years now despite the same models supporting 4.3-4.5 when booted to Windows? Essentially a dead man walking of an API.
« Last Edit: November 15, 2018, 03:02:17 pm by FRex »
Back to C++ gamedev with SFML in May 2023

Faberge

  • Newbie
  • *
  • Posts: 2
  • Right here, right now
    • View Profile
Re: OpenGL example from SFML and macOS Mojave
« Reply #2 on: November 16, 2018, 08:51:47 am »
Yes, the Graphics module works fine, I can compile and run a simple 2D examples from SFML Tutorial book I currently read. But not OpenGL 3D example. Maybe something needs to be change for linker options? I swear they were ok for High Sierra but still.

Quote
g++ -Wall -Wpedantic -std=c++17 -o "%e" "%f" -L /System/Library/Frameworks/OpenGL.framework/ -lsfml-graphics -lsfml-window -lsfml-system

 

anything