Advertisement

Could Not Debug Lesson 5

Started by February 27, 2011 09:12 AM
2 comments, last by Erik Rufelt 13 years, 8 months ago
I cannot debug the OpenGL Tutorial Lesson 5 when I copy the coding into a new project file. This is the error message that I had encountered:

1>c:\users\user\documents\visual studio 2008\projects\3d object\3d object\3d object.cpp([size="1"]118) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'

I am using Microsoft Visual C++ 2008.
You are probably compiling for unicode while the tutorial is written without support for it. You can surround your strings with TEXT("str") to automatically make strings wide-strings when needed.

If you want to compile the code as is, go into your project settings and under General settings change "Use Unicode Character Set" to "Not Set" for Character Set.
Advertisement
Thanks for the reply.

I have changed the Character Set. This time there were no errors when compiling. But when I tried to build the solution, it detects 21 errors regarding unresolved external symbol. Here are the errors:

1>try.obj : error LNK2019: unresolved external symbol _gluPerspective@32 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)

1>try.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)

1>try.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)

1>try.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)

1>try.obj : error LNK2019: unresolved external symbol __imp__glHint@8 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glDepthFunc@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glClearDepth@8 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glShadeModel@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glVertex3f@12 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glColor3f@12 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__wglDeleteContext@4 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__wglMakeCurrent@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)

1>try.obj : error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)[size="1"][size="1"]

You must link to opengl32.lib and glu32.lib. The easiest way is to add the following at the top of your main code file.

#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "glu32.lib")


Or you can go into your project settings again and under Linker and Input there is an additional dependencies option where you can add libraries.

This topic is closed to new replies.

Advertisement