mac下安裝配置freeglut,設定xcode
主要參考文章:
http://lazyfoo.net/tutorials/OpenGL/01_hello_opengl/mac/index.php
1) The first issue is that newer versions of OS X don't have X11. You'll have to install XQuartz, a quartz based port of X.org. Download the dmg and install it.
2) Download the latest source from the freeGLUT website.
Extract the archive, open a terminal window, cd to the extracted folder.
3) Configure the installation using this command in the extracted folder
env CPPFLAGS="-I/opt/X11/include" LDFLAGS="-L/opt/X11/lib" ./configure
When you installed XQuartz, it installs X11 to /opt/X11/lib. This command configures the build and tells it to look in /opt/X11/include for headers and /opt/X11/lib for library files.4) In freeGLUT 2.8.0 there's a bug in the source code that causes to break in OS X. In the freeGLUT source directory you extracted go to progs -> demos -> smooth_opengl3 and open up smooth_openg13.c.
Between lines 101 and 102 there's a bunch type definitions that are already in glext.h that cause a conflict.
make all
Now using root privileges, install the library with the command:sudo make install
6) Now that you've installed the development libraries, it's time to start up your IDE/compiler.smooth_opengl3.c:122:1: error:unknown type name 'PFNGLGENBUFFERSPROC'
PFNGLGENBUFFERSPROC gl_GenBuffers;
^
smooth_opengl3.c:123:1: error:unknown type name 'PFNGLBINDBUFFERPROC'
PFNGLBINDBUFFERPROC gl_BindBuffer;
^
smooth_opengl3.c:124:1: error:unknown type name 'PFNGLBUFFERDATAPROC'
PFNGLBUFFERDATAPROC gl_BufferData;
^
smooth_opengl3.c:125:1: error:unknown type name 'PFNGLCREATESHADERPROC'
PFNGLCREATESHADERPROC gl_CreateShader;
^
smooth_opengl3.c:126:1: error:unknown type name 'PFNGLSHADERSOURCEPROC'
PFNGLSHADERSOURCEPROC gl_ShaderSource;
^
smooth_opengl3.c:127:1: error:unknown type name 'PFNGLCOMPILESHADERPROC'
PFNGLCOMPILESHADERPROC gl_CompileShader;
^
smooth_opengl3.c:128:1: error:unknown type name 'PFNGLCREATEPROGRAMPROC'
PFNGLCREATEPROGRAMPROC gl_CreateProgram;
^
smooth_opengl3.c:129:1: error:unknown type name 'PFNGLATTACHSHADERPROC'
PFNGLATTACHSHADERPROC gl_AttachShader;
^
smooth_opengl3.c:130:1: error:unknown type name 'PFNGLLINKPROGRAMPROC'
PFNGLLINKPROGRAMPROC gl_LinkProgram;
^
smooth_opengl3.c:131:1: error:unknown type name 'PFNGLUSEPROGRAMPROC'
PFNGLUSEPROGRAMPROC gl_UseProgram;
^
smooth_opengl3.c:132:1: error:unknown type name 'PFNGLGETSHADERIVPROC'
PFNGLGETSHADERIVPROC gl_GetShaderiv;
^
smooth_opengl3.c:133:1: error:unknown type name 'PFNGLGETSHADERINFOLOGPROC'
PFNGLGETSHADERINFOLOGPROC gl_GetShaderInfoLog;
^
smooth_opengl3.c:134:1: error:unknown type name 'PFNGLGETPROGRAMIVPROC'
PFNGLGETPROGRAMIVPROC gl_GetProgramiv;
^
smooth_opengl3.c:135:1: error:unknown type name 'PFNGLGETPROGRAMINFOLOGPROC'
PFNGLGETPROGRAMINFOLOGPROC gl_GetProgramInfoLog;
^
smooth_opengl3.c:136:1: error:unknown type name 'PFNGLGETATTRIBLOCATIONPROC'
PFNGLGETATTRIBLOCATIONPROC gl_GetAttribLocation;
^
smooth_opengl3.c:137:1: error:unknown type name 'PFNGLVERTEXATTRIBPOINTERPROC'
PFNGLVERTEXATTRIBPOINTERPROC gl_VertexAttribPointer;
^
smooth_opengl3.c:138:1: error:unknown type name
'PFNGLENABLEVERTEXATTRIBARRAYPROC'
PFNGLENABLEVERTEXATTRIBARRAYPROC gl_EnableVertexAttribArray;
^
smooth_opengl3.c:139:1: error:unknown type name 'PFNGLGETUNIFORMLOCATIONPROC'
PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation;
^
smooth_opengl3.c:140:1: error:unknown type name 'PFNGLUNIFORMMATRIX4FVPROC'
PFNGLUNIFORMMATRIX4FVPROC gl_UniformMatrix4fv;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[4]: *** [smooth_opengl3-smooth_opengl3.o] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
有問題,於是把修改的巨集去掉。重新make all。沒有報錯。make install.
再參考:
http://lazyfoo.net/tutorials/OpenGL/01_hello_opengl/mac/xcode/index.php
Remove the main.cpp file autogenerated for the project as we're not using it. Go download the source for lesson 01. Add the source files inside to your project.
2)Click on your project to reveal the Build Settings tab. Click on the Build Settings tab. Under in the Linking section in the Other Linker Flags add -lGLUT. This will make the project link with the freeGLUT Unix library we installed.
3)In the Search Paths section add
"/opt/X11/include" "/usr/local/include"
to the Header Search Paths and"/opt/X11/lib" "/usr/local/lib"
to the Library Search PathsThis makes it so XCode will find the header/library files for XQuartz (/opt/X11/) and freeGLUT (/usr/local/).
4)Click on the Build Phases Tab, open up Link Binary with Libraries and add the OpenGL framework.
Now build. If there are any errors, make sure you didn't skip a step.
Now that you have OpenGL and freeGLUT compiling, it time to go onto part 2 of the tutorial.
to the Library Search Paths,圖片顯示有誤
相關文章
- PHP 基礎 - Mac 下的安裝與設定PHPMac
- Mac環境下安裝配置RedisMacRedis
- mac下安裝nginx及相關配置MacNginx
- VS+opengl 環境安裝,freeglut和glew方式
- (MAC) PHP安裝和配置MacPHP
- Mac 安裝與配置mongodbMacMongoDB
- Mac Flutter安裝與配置MacFlutter
- Linux下安裝JDK及環境設定LinuxJDK
- Mac下Nginx、PHP、MySQL 和 PHP-fpm安裝配置MacNginxPHPMySql
- Mac下安裝MongodbMacMongoDB
- Mac下安裝brewMac
- mac下安裝homebrewMac
- Mac下go安裝MacGo
- Linux下安裝java及配置(yum安裝)LinuxJava
- Mac上Git安裝與配置MacGit
- 關於Mac配置安裝MavenMacMaven
- windows下Tomcat安裝配置WindowsTomcat
- Linux下ODBC安裝配置Linux
- CentOS下tomcat安裝配置CentOSTomcat
- Mac下安裝配置Android Studio並讓多版本共存以及配置使用adbMacAndroid
- MAC 下 Vagrant 安裝 DokkuMac
- mac下安裝Vue DevToolsMacVuedev
- webpack安裝教程windows下、mac下WebWindowsMac
- JAVA下載安裝及設定環境變數Java變數
- Mac常用軟體安裝與配置Mac
- Ubuntu 16.04 下安裝配置caffeUbuntu
- maven下載、安裝與配置Maven
- Maven的下載安裝配置Maven
- Linux下rsync安裝與配置Linux
- Python 下載安裝和配置Python
- nodejs下載、安裝和配置NodeJS
- sublime Mac版怎麼安裝? Mac下載安裝sublime的教程Mac
- Mac下安裝xdebug-2.6.0Mac
- mac下用brew安裝 mysqlMacMySql
- Mac下安裝node-opencvMacOpenCV
- Mac 下使用homebrew安裝NVMMac
- Mac環境下安裝PodMac
- Mac 下載安裝redis 6.2MacRedis
- 安裝虛擬機器Ubuntu&配置SSH&配置samba&設定公鑰虛擬機UbuntuSamba