title: SDL2 compiling for Android with GLEW
body: <p>This is a compilation problem, specifically with referencing shared libraries with NDK.</p>
  
  <p>I have the SDL2 + GLEW program running fine on my mac (obviously with a different makefile/build system), and I have it running fine on Android as well (so long as I don't use GLEW). But now I need to use GLEW, and can't find a straightforward reference for how/where/what the heck is going on with including libraries in the NDK.</p>
  
  <p>Anyways- in my <code>android-project</code> folder, I have <code>jni/src/Android.mk</code> (which I assume is where I should be looking?)</p>
  
  <p>There's a line with <code>LOCAL_SHARED_LIBRARIES := SDL2 SDL2_image</code>, and I assume that's the magic variable that I shlould add <code>GLEW</code> to? But what even is that? How does that know what <code>GLEW</code> even means? Should it be <code>-lGLEW</code>? (that last question is rhetorical- I've tried all of them and nothing works). I've even tried commenting out that line totally and get the same build error:</p>
  
  <pre><code>jni/src/src/main.cpp:8:21: fatal error: GL/glew.h: No such file or directory
  #include &lt;GL/glew.h&gt;
  </code></pre>
  
  <p>I'm pretty much totally lost... does anyone have any resources I could look into?</p>
  
  <p>Also, as a note, I'd also prefer an explanation regarding why/what is going on, as I'm sure I'll be including other stuff as I go on.</p>
  
  <p>Edit:
  As Drop pointed out below, this wasn't a linking problem- the compiler needed to know where to find <code>GL/glew.h</code>. So I added <code>/usr/local/Cellar/glew/1.12.0/include</code> to the <code>LOCAL_C_INCLUDES :=</code> line, and that works. But now, there's an error compiling <code>glew.h</code>- <code>GL/glu.h: No such file or directory</code>. </p>
  
  <p>So now,</p>
  
  <ol>
  <li>is there a more general/clean/better way than hardcoding the whole <code>/usr/local/Cellar/glew/1.12.0/include</code> line to let the compiler know where GLEW is? Should <code>glew.h</code> be located somewhere more general?</li>
  <li>Why do I only need this when compiling for android? The mac build doesn't need these flags...</li>
  <li>I can't find clear documentation anywhere about this, but in compiling the mac build with GLEW, I <em>didn't</em> need to also install GLU and GLUT (like GLEW's website implied...), and further, neither GLU nor GLUT are available as packages via <code>brew</code>.</li>
  </ol>
  
  <p>I've been looking around for documentation about this, but I feel like I don't know what I don't know. Is there some insight you could give to where I'm going wrong regarding how includes and libraries and stuff are expected to be referenced across platforms?</p>