Need help fixing "unresolved external symbol glDrawArrays" issue.

I’m following the tutorial at open.gl (just type this into the address bar, it seems new accounts here can’t post urls) and everything has worked fine up until trying to call glDrawArrays.

Could someone explain what I’m missing?

I’m using SFML for the window context, so here are my headers:

#include <iostream>
#include <fstream>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <GL/glew.h>
#include <GL/wglew.h>

And I’m linking to the following libraries:

sfml/sfml-system.lib
sfml/sfml-window.lib
gl/glew32.lib

I’m doing this on a Windows 8 machine using MSVS Express 2012; my graphics card is OpenGL 4.2 capable. Am I missing a header declaration or a library?

EDIT: I’ll just post the full code here as well since it’s not much.

#include <iostream>
#include <fstream>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <GL/glew.h>
#include <GL/wglew.h>
using namespace std;

string GetFile(const char * filename);

int main()
{
	sf::Window window(sf::VideoMode(800, 600), "OpenGL", sf::Style::Close);
	glewExperimental = GL_TRUE;
	glewInit();

	GLuint vbo;
	glGenBuffers(1, &vbo);
	glBindBuffer(GL_ARRAY_BUFFER, vbo);

	float vertices[] =
	{
		0.0f, 0.5f,
		0.5f, -0.5f,
		-0.5f, -0.5f
	};

	glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

	
	const GLchar * vertexSource = GetFile("vertex.vert").c_str();
	GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
	glShaderSource(vertexShader, 1, &vertexSource, NULL);
	glCompileShader(vertexShader);

	GLint status;
	glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &status);

	cout << (status == GL_TRUE) << endl;

	const GLchar * fragmentSource = GetFile("fragment.frag").c_str();
	GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
	glShaderSource(fragmentShader, 1, &fragmentSource, NULL);
	glCompileShader(fragmentShader);

	GLuint shaderProgram = glCreateProgram();
	glAttachShader(shaderProgram, vertexShader);
	glAttachShader(shaderProgram, fragmentShader);
	glLinkProgram(shaderProgram);
	glUseProgram(shaderProgram);

	GLuint vao;
	glGenVertexArrays(1, &vao);
	glBindVertexArray(vao);

	GLint posAttribute = glGetAttribLocation(shaderProgram, "position");
	glVertexAttribPointer(posAttribute, 2, GL_FLOAT, GL_FALSE, 0, 0);
	glEnableVertexAttribArray(posAttribute);

	while(window.isOpen())
	{
		sf::Event windowEvent;
		while(window.pollEvent(windowEvent))
		{
			switch(windowEvent.type)
			{
			case sf::Event::Closed:
				window.close();
				break;
			}
		}
		glDrawArrays(GL_TRIANGLES, 0, 3);
	}
	return 0;
}

string GetFile(const char * filename)
{
	ifstream in(filename, std::ios::in | std::ios::binary);
	if(in)
	{
		string contents;
		in.seekg(0, std::ios::end);
		contents.resize(in.tellg());
		in.seekg(0, std::ios::beg);
		in.read(&contents[0], contents.size());
		in.close();
		return(contents);
	}
	
	return "";
}

I don’t recall the error-type. None-the-less, it could stem from ‘glDrawArrays’ is the first use of the program-object you created by ‘glUseProgram’. I don’t see any error-checking around building the shaders, linking and calling glUseProgram

https://www.khronos.org/opengl/wiki/OpenGL_Error#Meaning_of_errors