I am following a tutorial on 3D Environments in C++, and am trying to initialize these glut functions, but I get several errors on compile. Another stack overflow answer explained that you have to change your IOS X Development to 10.8 I believe, but I don’t know how to do that.
How can I resolve these errors?
CODE:
#include <iostream> #include <GLUT/glut.h> void display(){ glutSwapBuffers(); } int main(int argc, char **argv){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE); glutInitWindowSize(800,600); glutCreateWindow(""); glutDisplayFunc(display); glutMainLoop(); return 0; }
ERRORS:
helloworld.cpp:5:5: warning: 'glutSwapBuffers' is deprecated: first deprecated in macOS 10.9 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations] glutSwapBuffers(); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework/Headers/glut.h:448:22: note: 'glutSwapBuffers' has been explicitly marked deprecated here extern void APIENTRY glutSwapBuffers(void) OPENGL_DEPRECATED(10_0, 10_9); ^ helloworld.cpp:9:5: warning: 'glutInit' is deprecated: first deprecated in macOS 10.9 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations] glutInit(&argc, argv); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework/Headers/glut.h:431:22: note: 'glutInit' has been explicitly marked deprecated here extern void APIENTRY glutInit(int *argcp, char **argv) OPENGL_DEPRECATED(10_0, 10_9); ^ helloworld.cpp:10:5: warning: 'glutInitDisplayMode' is deprecated: first deprecated in macOS 10.9 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations] glutInitDisplayMode(GLUT_DOUBLE); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework/Headers/glut.h:432:22: note: 'glutInitDisplayMode' has been explicitly marked deprecated here extern void APIENTRY glutInitDisplayMode(unsigned int mode) OPENGL_DEPRECATED(10_0, 10_9); ^ helloworld.cpp:11:5: warning: 'glutInitWindowSize' is deprecated: first deprecated in macOS 10.9 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations] glutInitWindowSize(800,600); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework/Headers/glut.h:437:22: note: 'glutInitWindowSize' has been explicitly marked deprecated here extern void APIENTRY glutInitWindowSize(int width, int height) OPENGL_DEPRECATED(10_0, 10_9); ^ helloworld.cpp:12:5: warning: 'glutCreateWindow' is deprecated: first deprecated in macOS 10.9 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations] glutCreateWindow(""); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework/Headers/glut.h:441:21: note: 'glutCreateWindow' has been explicitly marked deprecated here extern int APIENTRY glutCreateWindow(const char *title) OPENGL_DEPRECATED(10_0, 10_9); ^ helloworld.cpp:13:5: warning: 'glutDisplayFunc' is deprecated: first deprecated in macOS 10.9 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations] glutDisplayFunc(display); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework/Headers/glut.h:505:22: note: 'glutDisplayFunc' has been explicitly marked deprecated here extern void APIENTRY glutDisplayFunc(void (*func)(void)) OPENGL_DEPRECATED(10_0, 10_9); ^ helloworld.cpp:14:5: warning: 'glutMainLoop' is deprecated: first deprecated in macOS 10.9 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations] glutMainLoop(); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework/Headers/glut.h:438:22: note: 'glutMainLoop' has been explicitly marked deprecated here extern void APIENTRY glutMainLoop(void) OPENGL_DEPRECATED(10_0, 10_9); ^ 7 warnings generated. Undefined symbols for architecture x86_64: "_glutCreateWindow", referenced from: _main in helloworld-796a26.o "_glutDisplayFunc", referenced from: _main in helloworld-796a26.o "_glutInit", referenced from: _main in helloworld-796a26.o "_glutInitDisplayMode", referenced from: _main in helloworld-796a26.o "_glutInitWindowSize", referenced from: _main in helloworld-796a26.o "_glutMainLoop", referenced from: _main in helloworld-796a26.o "_glutSwapBuffers", referenced from: display() in helloworld-796a26.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Anonymous Asked question May 14, 2021
Recent Comments