PDA

View Full Version : Installation problems



bsperlin
02-11-2010, 12:55 PM
Hello,
I am trying to get OpenGL working on my Win XP Prof machine with Visual C++ 2005 Express Edition.
The lines below:

int _tmain(int argc, _TCHAR* argv[])
{

glutInit( &argc, argv );

cause a compile error:

error C2664: 'glutInit' : cannot convert parameter 2 from '_TCHAR *[]' to 'char **'

I have followed the tutorial:

http://www.videotutorialsrock.com/opengl_tutorial/get_opengl_setup_windows/text.php

and have done everything except get the Microsoft Platform SDK, for which I will have to buy the DVD as my dialup modem (and I) would die of old age before downloading.
Is this missing SDK the cause of the compile error or is it something else (and maybe I can skip getting the Platform SDK)?
Thanks,
bsperlin

ZbuffeR
02-11-2010, 01:25 PM
I am pretty sure the Platform SDK is mandatory for doing anything useful with VC++.

If download size is a problem, you will probably have better luck trying with Code::Blocks + mingw, much smaller footprint.

ktamail
02-11-2010, 01:56 PM
try change the main function to:

int main(int argc, char** argv){
etc...
}

sorry this message to bsperlin.

bsperlin
02-11-2010, 02:43 PM
Hi ktamail,
That change worked as far as letting me get through the glutInit() function, but then glutKeyboardFunc causes a run time error:

Unhandled exception at 0x1000bb1e in Universe2010.exe: 0xC0000005: Access violation reading location 0x00000070.

Is there an way around this? If not I will have to try ZbuffeR's idea or get the DVD.
bsperlin

ktamail
02-12-2010, 12:10 AM
past the source code what to compile, because this error, from C++ programming error. maybe it's uninitalized variables.

glutCreateWindows then glutKeyboardFunc
not change the sequence.

for example function calls in main:

glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutInitWindowSize(1024,768);
glutCreateWindow("test");
glutDisplayFunc(scene);
glutKeyboardFunc(key);
glutMainLoop();

the scene and key function need write to work this.

yooyo
02-12-2010, 05:31 AM
Wild guess.. your project is unicode... and glut still use old ascii. Switch your project to use multi-byte chars instead of unicode.

ktamail
02-12-2010, 12:09 PM
i did't guess, i change that two lines and i have got same error:

Unhandled exception at 0x10008563 in test.exe: 0xC0000005: Access violation reading location 0x00000070.

I think that, you will not create window, you unable attach to "keyboard" to window, because you haven't window's handle.

from glut source:

/* CENTRY */
void GLUTAPIENTRY
glutKeyboardFunc(GLUTkeyboardCB keyboardFunc)
{
__glutChangeWindowEventMask(KeyPressMask,
keyboardFunc != NULL || __glutCurrentWindow->special != NULL);
__glutCurrentWindow->keyboard = keyboardFunc;
}

you see window must be created.

I compiled multi-byte and unicode and works fine together.

feilee
03-03-2010, 01:21 AM
i got problem when compile opengl project in codeblock.
every time i compile,the glut.h will come out and say there is 3 error in my code.
but i have try the code in other computer and can be compiled.Is it the problem of my laptop or the glut.h library i download has problem.please reply me.thanks.