Tôi đang làm some tutorials on OpenGL sử dụng FreeGLUT.Có thể xây dựng FreeGLUT trên Mac OS X không?
Apparently đây là cách bạn xây dựng và cài đặt nó trên mac:
CPPFLAGS="-I/usr/X11R6/include" ./configure --prefix="${PWD}/../"
make
make install
Thật không may này ngày của riêng mình mang lại cho tôi một lỗi khi tôi làm make
lệnh: Undefined symbols for architecture x86_64
Sau khi thực hiện abit của công việc Tôi đã thấy rằng cải tiến trên dòng đầu tiên là:
CPPFLAGS="-I/usr/X11R6/include -L/usr/X11R6/lib" LDFLAGS="-L/usr/X11R6/lib" ./configure --prefix="${PWD}/../"
Thật không may khi tôi làm make
Lệnh Tôi vẫn gặp lỗi:
gcc -DHAVE_CONFIG_H -I. -I../../.. -I/usr/X11R6/include -L/usr/X11R6/lib -I../../../include -g -O2 -Wall -pedantic -MT smooth_opengl3-smooth_opengl3.o -MD -MP -MF .deps/smooth_opengl3-smooth_opengl3.Tpo -c -o smooth_opengl3-smooth_opengl3.o `test -f 'smooth_opengl3.c' || echo './'`smooth_opengl3.c
smooth_opengl3.c:101: error: redefinition of typedef ‘PFNGLGENBUFFERSPROC’
/usr/X11R6/include/GL/glext.h:5080: error: previous declaration of ‘PFNGLGENBUFFERSPROC’ was here
smooth_opengl3.c:102: error: redefinition of typedef ‘PFNGLBINDBUFFERPROC’
/usr/X11R6/include/GL/glext.h:5078: error: previous declaration of ‘PFNGLBINDBUFFERPROC’ was here
smooth_opengl3.c:103: error: redefinition of typedef ‘PFNGLBUFFERDATAPROC’
/usr/X11R6/include/GL/glext.h:5082: error: previous declaration of ‘PFNGLBUFFERDATAPROC’ was here
smooth_opengl3.c:104: error: redefinition of typedef ‘PFNGLCREATESHADERPROC’
/usr/X11R6/include/GL/glext.h:5197: error: previous declaration of ‘PFNGLCREATESHADERPROC’ was here
smooth_opengl3.c:105: error: redefinition of typedef ‘PFNGLSHADERSOURCEPROC’
/usr/X11R6/include/GL/glext.h:5222: error: previous declaration of ‘PFNGLSHADERSOURCEPROC’ was here
smooth_opengl3.c:106: error: redefinition of typedef ‘PFNGLCOMPILESHADERPROC’
/usr/X11R6/include/GL/glext.h:5195: error: previous declaration of ‘PFNGLCOMPILESHADERPROC’ was here
smooth_opengl3.c:107: error: redefinition of typedef ‘PFNGLCREATEPROGRAMPROC’
/usr/X11R6/include/GL/glext.h:5196: error: previous declaration of ‘PFNGLCREATEPROGRAMPROC’ was here
smooth_opengl3.c:108: error: redefinition of typedef ‘PFNGLATTACHSHADERPROC’
/usr/X11R6/include/GL/glext.h:5193: error: previous declaration of ‘PFNGLATTACHSHADERPROC’ was here
smooth_opengl3.c:109: error: redefinition of typedef ‘PFNGLLINKPROGRAMPROC’
/usr/X11R6/include/GL/glext.h:5221: error: previous declaration of ‘PFNGLLINKPROGRAMPROC’ was here
smooth_opengl3.c:110: error: redefinition of typedef ‘PFNGLUSEPROGRAMPROC’
/usr/X11R6/include/GL/glext.h:5223: error: previous declaration of ‘PFNGLUSEPROGRAMPROC’ was here
smooth_opengl3.c:111: error: redefinition of typedef ‘PFNGLGETSHADERIVPROC’
/usr/X11R6/include/GL/glext.h:5209: error: previous declaration of ‘PFNGLGETSHADERIVPROC’ was here
smooth_opengl3.c:112: error: redefinition of typedef ‘PFNGLGETSHADERINFOLOGPROC’
/usr/X11R6/include/GL/glext.h:5210: error: previous declaration of ‘PFNGLGETSHADERINFOLOGPROC’ was here
smooth_opengl3.c:113: error: redefinition of typedef ‘PFNGLGETPROGRAMIVPROC’
/usr/X11R6/include/GL/glext.h:5207: error: previous declaration of ‘PFNGLGETPROGRAMIVPROC’ was here
smooth_opengl3.c:114: error: redefinition of typedef ‘PFNGLGETPROGRAMINFOLOGPROC’
/usr/X11R6/include/GL/glext.h:5208: error: previous declaration of ‘PFNGLGETPROGRAMINFOLOGPROC’ was here
smooth_opengl3.c:115: error: redefinition of typedef ‘PFNGLGETATTRIBLOCATIONPROC’
/usr/X11R6/include/GL/glext.h:5206: error: previous declaration of ‘PFNGLGETATTRIBLOCATIONPROC’ was here
smooth_opengl3.c:116: error: redefinition of typedef ‘PFNGLVERTEXATTRIBPOINTERPROC’
/usr/X11R6/include/GL/glext.h:5280: error: previous declaration of ‘PFNGLVERTEXATTRIBPOINTERPROC’ was here
smooth_opengl3.c:117: error: redefinition of typedef ‘PFNGLENABLEVERTEXATTRIBARRAYPROC’
/usr/X11R6/include/GL/glext.h:5202: error: previous declaration of ‘PFNGLENABLEVERTEXATTRIBARRAYPROC’ was here
smooth_opengl3.c:118: error: redefinition of typedef ‘PFNGLGETUNIFORMLOCATIONPROC’
/usr/X11R6/include/GL/glext.h:5212: error: previous declaration of ‘PFNGLGETUNIFORMLOCATIONPROC’ was here
smooth_opengl3.c:119: error: redefinition of typedef ‘PFNGLUNIFORMMATRIX4FVPROC’
/usr/X11R6/include/GL/glext.h:5242: error: previous declaration of ‘PFNGLUNIFORMMATRIX4FVPROC’ was here
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] Error 2
Đây là documented on the net before, nhưng giải pháp không thực sự hữu ích trong trường hợp này. Tôi cũng đã cố gắng trao đổi nó cho GLUT.framwork đi kèm với OS X, nhưng các ví dụ đang sử dụng các chức năng đặc biệt của FreeGLUT.
Ok, tôi đã có một chút nữa trong việc này. Sử dụng 'CPPFLAGS =" - I/usr/X11R6/bao gồm -L/usr/X11R6/lib "./configure --prefix =" $ {PWD} /../ "' loại bỏ lỗi 'Ký hiệu không xác định'. Nhưng bây giờ tôi nhận được 'ld: thư viện không tìm thấy cho -lGL' \' collect2: ld trả về 1 trạng thái thoát' \ 'make [2]: *** [libglut.la] Lỗi 1' \' make [1]: * ** [all-đệ quy] Lỗi 1'/'make: *** [tất cả] Lỗi 2' – bjz
Có lẽ bạn cũng nên kiểm tra với LDFLAGS,' -L/usr/X11R6/lib' là cần thiết. – ZhangChn
Ooh cảm ơn. Ok vì vậy tôi đã sử dụng 'CPPFLAGS =" - I/usr/X11R6/bao gồm -L/usr/X11R6/lib "LDFLAGS =" - L/usr/X11R6/lib "./configure --prefix =" $ {PWD}/../ "' và tôi đã loại bỏ lỗi trước đó. Bây giờ tôi nhận được một tải toàn bộ các lỗi dọc theo dòng 'smooth_opengl3.c: 101: lỗi: định nghĩa lại typedef 'PFNGLGENBUFFERSPROC'' \' /usr/X11R6/include/GL/glext.h:5080: lỗi: khai báo trước đó của 'PFNGLGENBUFFERSPROC' đã ở đây' – bjz