Confusing Undefined Reference To A Function

I’m following the Modern OpenGL wikibooks tutorial and I’ve run into an issue with an undefined reference. In the init_resources(void) method, I have this code:


GLuint vs, fs;

if ((vs = create_shader("triangle.v.glsl", GL_VERTEX_SHADER)) == 0)
  return 0;

The create_shader method is included from a separate “shader_utils.h” file with a corresponding shader_utils.cpp implementation.

shader_utils.h


#ifndef _CREATE_SHADER_H
#define _CREATE_SHADER_H
#include <GL/glew.h>

char* file_read(const char* filename);
void print_log(GLuint object);
GLuint create_shader(const char* filename, GLenum type);

#endif

shader_utils.cpp


#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>

...

GLuint create_shader(const char* filename, GLenum type)
{
  ...
  return res;
}

I’m using CodeBlocks and I know you have to add the project include directory to the search directories for the project. In fact, code completion even suggests the create_shader method and shows the correct parameters. And if I call the method with the wrong parameters, it gives me an error about using the wrong number of parameters. But despite all of that, when I try to build this code it gives me an "undefined reference to ‘create_shader’ error. Maybe it’s just late, but I can’t figure out why.

Sorry, I must be tired. I just noticed I had named the shader_utils file as a c++ file instead of c. I can’t see how to delete this post, but everything is fine now!