Updating glfw to the latest version

Hello,

Since there is a big vsync problem in mojave i need to update glfw to the latest commit. I downloaded and compiled glfw made a dylib file and added it to my project along with glfw3.h and glfw3native.h. This fails to compile and get the following errors

Reference to ‘Size’ is ambiguous.
Reference to ‘Point’ is ambiguous.

Simple but long option would be adding cocos2d:: before each point/size. Is there any other way to do this?

i compiled glfw into static lib, then replace libglfw3.a in “prebuilt” folder and glfw3.h in “include” folder of cocos2d-x, nothing else, no problems with “ambiguous” errors.

Maybe I’m compiling it wrong… Is it possible for you to send me the libglfw3.a?
Thanks

My libglfw3.a is not from last commit, it was about 1-2 month ago. Maybe better to post full tutorial how to compile to static lib?

sure a tutorial would be great. is your vsync problem fixed?

My mac mid-2010 can’t run mojave, but my friend with 2019 mac book pro report no problems with vsync.

Trying your files wont hurt :D. I can let you know if the vsync is fixed in your version. since its hard to notice it.

https://drive.google.com/open?id=1g8wbe43g-L8fwL8ht2v5lnu2RI8cTiPt

1 Like

Yes, please.

Try “using namespace cocos2d”

@hexerror hey! thanks for the files. It doesn’t have the vsync fix.

Took me a 1.5 hrs but I included the new glfw by adding cocos2d:: to all Point, Rect and Size. Just to see if the problem is fixed and it is. Gameplay is running perfectly smooth. This was tested on latest macbook 2018.

but above fix is not recommended. I need to make static libraries like you did.

Ok, compile instructions:

  1. clone glfw git: open terminal, type “git clone https://github.com/glfw/glfw”, wait for clone complete, cd to glfw folder
  2. run cmake gui utility (if dont have it, install from https://cmake.org), press “Browse Source…” and select glfw folder, then press “Browse Build…” and select build folder (i prefer create “bin” folder inside glfw folder), then press “Configure” button, wait for config script complete, on main screen make sure BUIL_SHARED_LIBS unchecked (unchecked by default), set CMAKE_OSX_DEPLOYMENT_TARGET as you wish (my games support osx since osx 10.9), then press “Generate” button.
  3. cd to build folder (“bin” in my example), open GLFW.xcodeproj in xcode, on top of xcode window, next to run and stop buttons, press drop-down projects menu and select “glfw”, then in xcode global menu select Product->build for->Running (for debug build) and Product->build for->Profilling (for release build), wait fo compile, then go to src->Debug(or Release) subfolder, and get fresh libglfw3.a :slight_smile:
1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.