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,圖片顯示有誤
相關文章
- mac下安裝配置nginxMacNginx
- PHP 基礎 - Mac 下的安裝與設定PHPMac
- Mac環境下安裝配置RedisMacRedis
- mac下安裝nginx及相關配置MacNginx
- Mac下配置免安裝的tomcatMacTomcat
- VS+opengl 環境安裝,freeglut和glew方式
- Mac 下 Nginx、MySQL、PHP-FPM 的安裝配置MacNginxMySqlPHP
- Mac Flutter安裝與配置MacFlutter
- (MAC) PHP安裝和配置MacPHP
- Mac 安裝配置rz、szMac
- mac MYSQL安裝和配置MacMySql
- OpenGrok安裝配置-MAC篇Mac
- Mac 安裝與配置mongodbMacMongoDB
- Mac下安裝brewMac
- mac下安裝homebrewMac
- Mac下安裝MongodbMacMongoDB
- Mac 下安裝pipMac
- mac下安裝vagrantMac
- MAC 下安裝 cassandraMac
- Mac下Nginx、PHP、MySQL 和 PHP-fpm安裝配置MacNginxPHPMySql
- Windows平臺下sbt的安裝設定Windows
- Mac上Git安裝與配置MacGit
- 關於Mac配置安裝MavenMacMaven
- Mac 安裝和配置gradleMacGradle
- Mac OS X下開發軟體的安裝與配置Mac
- MAC 下 Vagrant 安裝 DokkuMac
- Mac下安裝VirtualBoxMac
- Java Mac下安裝mysqlJavaMacMySql
- mac下安裝TomcatMacTomcat
- Mac 下安裝tomcatMacTomcat
- MAC下homebre安裝mysqlMacMySql
- Mac os下profile設定Mac
- webpack安裝教程windows下、mac下WebWindowsMac
- CentOS下安裝配置cmakeCentOS
- ubuntu下cacti安裝配置Ubuntu
- Jmeter安裝設定JMeter
- Ubuntu安裝設定Ubuntu
- Linux下安裝JDK及環境設定LinuxJDK