OpenGL Occlusion Query[Help!]

i have been trying to conduct a occlusion query with

function ‘glBeginQuery(GL_SAMPLES_PASSED,queryid);’. however,

there is a error that says 'glBeginQuery : undeclared

identifier ’ and ‘GL_SAMPLES_PASSED: undeclared identifier’;

i have included ‘gl\gl.h’,‘gl\glu.h’ & ‘gl\glaux.h’.

Could any buddy do me a favor to solve this problem? thanks!

Try using an extension loader like GLEW to load newer OpenGL functions at runtime. It also provides more up to date headers where GL_SAMPLES_PASSED is declared.

In case that doesn’t help, please also tell us what OS and what OpenGL version you have.

i have installed the latest GLEW correctly, whose version is glew-1.7.0-win32. However, it still doesn’t work that comes new errors:
“error LNK2001: unresolved external symbol __imp____glewBeginQuery” and
“error LNK2001: unresolved external symbol __imp____glewEndQuery”

also, i have inlcuded glew.h before gl.h, glu.h & glaux.h like following:
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glaux.h>

Without using glBeginQuery() or glEndQuery(), debugging is passed and the application program runs without errors.

my operation system is: WINDOWS 7_32bit
GL_VERSION is: 4.1.0
GLU_VERSION is: Microsoft Corporation

if any solution exists, please help me! thx

the platform is Visual Studio 6.0;
i have read the document ‘glew.h’ and find the relevant information that maybe help when you think about this problem:
#define glBeginQuery GLEW_GET_FUN(__glewBeginQuery)