我在Xcode 8.3.2中使用SDL2(最新的OSX二進制文件),C++和OpenGL。如果我只是從代碼中調用SDL2函數,該項目會很好地構建。但是,當我在代碼中包含任何OpenGL函數調用時,它將無法編譯。我已經在文件頭中包含了<OpenGL/gl3.h>
。但我正在逐漸編譯過程中出現以下錯誤,每當我在代碼中調用任何OpenGL的方法:在SDL項目中調用OpenGL函數使其無法在OSX下編譯
:
#ifndef Display_h
#define Display_h
#include <iostream>
#include <SDL2/SDL.h>
#include <OpenGL/gl3.h>
...
在Display.cpp:
void Display::Clear(float r, float g, float b, float a)
{
glClearColor(r,g,b,a);
}
我運行OSX 10.12
請閱讀[我如何問一個好問題?](https://stackoverflow.com/help/how-to-ask)和[如何創建一個最小,完整和可驗證示例](https:/ /stackoverflow.com/help/mcve)。 – Rabbid76