openglonmetal / MGL

OpenGL 4.6 on Metal
Apache License 2.0
781 stars 30 forks source link

Compilation Error #67

Open ghost opened 1 year ago

ghost commented 1 year ago

I'm trying to build MGL, following instructions from build.md, but through the process I'm getting a missing header error. Concretely:

In file included from /Users/ilya/D/cpp/MGL/glfw/src/monitor.c:30:
In file included from /Users/ilya/D/cpp/MGL/glfw/src/internal.h:331:
In file included from /Users/ilya/D/cpp/MGL/glfw/src/platform.h:42:
/Users/ilya/D/cpp/MGL/glfw/src/cocoa_platform.h:32:10: fatal error: 'MGLContext.h' file not found
#include "MGLContext.h"
         ^~~~~~~~~~~~~~
In file included from /Users/ilya/D/cpp/MGL/glfw/src/context.c:30:
In file included from /Users/ilya/D/cpp/MGL/glfw/src/internal.h:331:
In file included from /Users/ilya/D/cpp/MGL/glfw/src/platform.h:42:
/Users/ilya/D/cpp/MGL/glfw/src/cocoa_platform.h:32:10: fatal error: 'MGLContext.h' file not found
#include "MGLContext.h"
         ^~~~~~~~~~~~~~
In file included from /Users/ilya/D/cpp/MGL/glfw/src/input.c:30:
In file included from /Users/ilya/D/cpp/MGL/glfw/src/internal.h:331:
In file included from /Users/ilya/D/cpp/MGL/glfw/src/platform.h:42:
/Users/ilya/D/cpp/MGL/glfw/src/cocoa_platform.h:32:10: fatal error: 'MGLContext.h' file not found
#include "MGLContext.h"
         ^~~~~~~~~~~~~~
In file included from /Users/ilya/D/cpp/MGL/glfw/src/init.c:30:
In file included from /Users/ilya/D/cpp/MGL/glfw/src/internal.h:331:
In file included from /Users/ilya/D/cpp/MGL/glfw/src/platform.h:42:
/Users/ilya/D/cpp/MGL/glfw/src/cocoa_platform.h:32:10: fatal error: 'MGLContext.h' file not found
#include "MGLContext.h"
         ^~~~~~~~~~~~~~
1 error generated.
1 error generated.
1 error generated.
make[3]: *** [src/CMakeFiles/glfw.dir/context.c.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [src/CMakeFiles/glfw.dir/monitor.c.o] Error 1
make[3]: *** [src/CMakeFiles/glfw.dir/init.c.o] Error 1
1 error generated.
make[3]: *** [src/CMakeFiles/glfw.dir/input.c.o] Error 1
make[2]: *** [src/CMakeFiles/glfw.dir/all] Error 2
make[1]: *** [src/CMakeFiles/glfw.dir/rule] Error 2
make: *** [glfw] Error 2
The-Minecraft-Scientist commented 1 year ago

you need to tell XCode to include the missing headers (which can be found in MGL/include), like this: (click the little plus button to add headers to include)

Screen Shot 2023-02-06 at 6 51 04 PM
redeemarr commented 1 year ago

I've stumbled against the same problem. It happened on running build_external script, not building the XCode project. I assume that OP meant the same. I'm also assuming that adding headers in 'build phases' won't resolve this. So I decided just to hardcode absolute paths to MGLContext.h and MGLRenderer.h in cocoa_platform.h and mgl_context.m. It helped, but the way is very rude. However, building MGL shared library (step 2 from BUILD.md) fails with a lot of errors :)