PDA

View Full Version : can't get the project compiled



suzanne14
04-14-2009, 04:00 PM
Hi, I am completely new to OpenGl (started few hours ago ... ), I have written some example (exactlier, copied it from some book :D ), please can any one help me ??
Here is the code:

"demo.h"

#include <windows.h>
#include <GL/gl.h>
#pragma comment (lib, "OpenGL32.lib")
#include <GL/glu.h>
#pragma comment (lib, "Glu32.lib")
#include <GL/glaux.h>
#pragma comment( lib, "glaux.lib" )
class demo1
{
public:
demo1(void);
~demo1(void);
void CALLBACK resize(int, int);
void CALLBACK display(void);
};

"demo1.cpp"

#include "demo1.h"

demo1::demo1(void)
{
}

demo1::~demo1(void)
{
}

void demo1::resize(int width, int height)
{
//...
}

void demo1::display(void)
{
//...
}

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
auxInitPosition(0, 0, 500, 500);
//...

auxIdleFunc(demo1::display);

auxReshapeFunc(demo1::resize);
//...
glEnable(GL_ALPHA_TEST);
//...
}


The errors I get are at auxIdleFunc(demo1::display) and auxReshapeFunc(demo1::resize); (demo1.cpp(31) : error C3867: 'demo1::display': function call missing argument list; use '&demo1::display' to create a pointer to member); if I put the '&' I get 'demo1.cpp(31) : error C2664: 'auxIdleFunc' : cannot convert parameter 1 from 'void (__stdcall demo1::* )(void)' to 'AUXIDLEPROC''.
Also if I comment those 2 functions I get some link error: 'error LNK2019: unresolved external symbol _auxInitPosition@16 referenced in function _WinMain@16'.

I have searched on the Web & found something about adding some library references to the project, added them - still same link errors; then I found something about changing the type of project from 'console' to 'windows'.
Currenly I use a Win32 Windows application under VS 2008.
Heeeelp me PLEASE !!!!!!!!!!!!!!!!!!!!!!

remdul
04-14-2009, 05:26 PM
I would not recommend to use any tutorials using GLaux, it is outdated and depreciated. Look for GLUT (or better, FreeGLUT) tutorials.

suzanne14
04-14-2009, 06:33 PM
Can you please explain me how should I add to my project the glut32 library ?..... I have copied the glut32.h to the gl directory from 'C:\Program Files\Microsoft SDKs\ ... \Include' & the library to the lib directory from the same path ....

Ilian Dinev
04-14-2009, 07:29 PM
A quick and nice way is to put this anywhere in your code:
#pragma comment(lib,"glut32.lib")

Otherwise, you go to "project properties-> linker-> input" and specify the .lib files.

suzanne14
04-17-2009, 10:23 AM
Thanks, it worked :). I also had to place glut32.dll into the System32 folder because of 'This application has failed to start because glut32.dll was not found. Re-installing the application may fix the problem'.

ZbuffeR
04-17-2009, 11:41 PM
Then you should instead put glut32.dll in the same folder your .exe is.