Glfw3.h is no longer recognized after gcc version 5.5

Asked 2 years ago, Updated 2 years ago, 81 views

The raw string literal on the mac got an error, so I thought it was not compatible with C++11. When I installed gcc5 using MacPorts, the glfw3 that I had previously installed on HomeBrew was no longer recognized when I compiled it.Is there a solution to this?

terminal
$ gcc main.cpp-framework OpenGL-lglfw
main.cpp:1:24: fatal error:GLFW/glfw3.h: No such file or directory
compilation terminated.

c++ macos homebrew opengl

2022-09-29 22:32

2 Answers

Since GLFW/glfw3.h appears in the error, would the compilation argument be -lglfw3 instead of -lglfw
Alternatively, the -I option explicitly specifies the directory in which the header file resides in the include path.If /path/to/include/GLFW/glfw3.h has a file,

$gccmain.cpp-framework OpenGL-I/path/to/include-lglfw


2022-09-29 22:32

I downloaded the source code from the site instead of the glfw installed in brew, created the library from Cmake to makefile, and wrote down the path to which it was located, and the compilation passed.

I don't really understand......


2022-09-29 22:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.