PDA

View Full Version : LNK2019 errors with Visual C++ 2010 Express



Dancer
05-19-2014, 01:40 PM
I have a Win 7, 64-bit Win computer and am following the Guide to installing OpenGL for Windows, through the download section of www.sumantaguha.com. I installed Visual C++ 2010 Express, glew, freeglut and glext.h files in the suggested places. I am now getting LNK2019 errors.
I added glew32.lib, glew32s.lib, and freeglut.lib to the Linker Additional Dependencies. For the Linker Additional Library Directories I added the following, both separately and together, believing that maybe the %28x86%29 was a problem.
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Lib
I then tried placing copies of the glew32.lib, glew32s.lib, and freeglut.lib in the project directory and the debug subdirectory.
The following is a section of the code, followed by the error messages.

I would like some help getting started. Thanks.

///////////////////////////////////
// square.cpp
//
// OpenGL program to draw a square.
//
// Sumanta Guha.
///////////////////////////////////

#ifdef __APPLE__
# include <GL/glew.h>
# include <GL/freeglut.h>
# include <OpenGL/glext.h>
#else
# include <GL/glew.h>
# include <GL/freeglut.h>
# include <GL/glext.h>
#pragma comment(lib, "glew32.lib")
#endif

// Drawing routine.
void drawScene(void)

1>------ Build started: Project: Starting_square, Configuration: Debug Win32 ------
1> my_square.cpp
1>my_square.obj : error LNK2019: unresolved external symbol __imp__glutMainLoop@0 referenced in function _main
1>my_square.obj : error LNK2019: unresolved external symbol __imp__glutKeyboardFunc@4 referenced in function _main
SNIP

referenced in function _glutInit_ATEXIT_HACK@8
1>C:\Users\JCR\AAA_JCR\VS_2010_Express\Starting_squa re\Debug\Starting_square.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

vickoza
05-24-2014, 08:01 PM
Where is your glew.lib? that should be is you project directory under you project Linker input

Dancer
06-04-2014, 09:49 AM
Thanks for the suggestion!
In Visual C++ 2010 Express, when I changed the Linker Additional Library Directories to the parent directory \lib, rather than \lib\Release\Win32 which actually contains glew.lib, I was able to get the Build to succeed. Unfortunately, when I run the executable I get the following message box appearing "Square.exe - Entry Point Not Found. The procedure entry point glewInit could not be located in the dynamic link library glew32.dll." I had placed a copy of glew32.dll in the same directory as the executable. I am using glew-1.10.0

More suggests for the next step are very welcome!