Question

I'm trying to compile this C++ program which utilizes the GLUT32 libraries.

Right now I'm getting the following errors:

Error 1 error LNK2001: unresolved external symbol _gluPerspective@32 Camera.obj soundCube Error 2 error LNK2001: unresolved external symbol _gluLookAt@72 Camera.obj soundCube Error 3 error LNK2001: unresolved external symbol __imp__glMaterialfv@12 GLWindow.obj soundCube Error 4 error LNK2001: unresolved external symbol __imp__glClear@4 GLWindow.obj soundCube Error 5 error LNK2001: unresolved external symbol __imp__glClearColor@16 GLWindow.obj soundCube Error 6 error LNK2001: unresolved external symbol __imp__glMaterialf@12 GLWindow.obj soundCube Error 7 error LNK2001: unresolved external symbol __imp__glEnd@0 GLWindow.obj soundCube Error 8 error LNK2001: unresolved external symbol __imp__glRasterPos2f@8 GLWindow.obj soundCube Error 9 error LNK2001: unresolved external symbol __imp__timeGetTime@0 GLWindow.obj soundCube Error 10 error LNK2001: unresolved external symbol __imp__glDisable@4 GLWindow.obj soundCube Error 11 error LNK2001: unresolved external symbol __imp__glBegin@4 GLWindow.obj soundCube Error 12 error LNK2001: unresolved external symbol __imp__glColor4f@16 GLWindow.obj soundCube Error 13 error LNK2001: unresolved external symbol __imp__glPopMatrix@0 GLWindow.obj soundCube Error 14 error LNK2001: unresolved external symbol __imp__glPushMatrix@0 GLWindow.obj soundCube Error 15 error LNK2001: unresolved external symbol __imp__glRotatef@16 GLWindow.obj soundCube Error 16 error LNK2001: unresolved external symbol __imp__glBlendFunc@8

...

Error 56 fatal error LNK1120: 55 unresolved externals C:\Users\Simucal\Documents\Downloads\SoundCubeSrc soundCube

I'm not that experienced in C++ but I've tried to set up GLUT correctly so this project can link against it.

I downloaded the GLUT32 library for Nate Robin's page.

I then placed the following files in:

  • glut.h - C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl
  • glut32.lib - C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
  • glut.dll - C:\Windows\System32

I also selected the Project -> Properties -> Linker -> Additional Dependencies -> Added "glut32.lib"

If anyone wants to see what project I'm working with, it is here.

What step am I missing or doing wrong in order to resolve these errors?

Was it helpful?

Solution

The unresolved symbols are from the GL and GLU libraries. You need to add the link libraries for them as well.

OTHER TIPS

it looks to me like you're mixing static and dynamic link options. I'm downloading your project to investigate, but what type of compilation are you doing?

I didn't see a reference to the glut .lib file in the project...

I added the library reference and LIB/INCLUDE paths:

diff --git a/soundCube/soundCube.vcproj b/soundCube/soundCube.vcproj
index 62e04c1..b71eb20 100644
--- a/soundCube/soundCube.vcproj
+++ b/soundCube/soundCube.vcproj
@@ -41,6 +41,7 @@
            <Tool
                Name="VCCLCompilerTool"
                Optimization="0"
+               AdditionalIncludeDirectories="d:\temp\glut"
                PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
                MinimalRebuild="true"
                BasicRuntimeChecks="3"
@@ -60,7 +61,9 @@
            />
            <Tool
                Name="VCLinkerTool"
+               AdditionalDependencies="glut32.lib"
                LinkIncremental="2"
+               AdditionalLibraryDirectories="d:\temp\glut\GL"
                GenerateDebugInformation="true"
                SubSystem="1"
                TargetMachine="1"
@@ -114,6 +117,7 @@
                Name="VCCLCompilerTool"
                Optimization="2"
                EnableIntrinsicFunctions="true"
+               AdditionalIncludeDirectories="d:\temp\glut"
                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
                RuntimeLibrary="0"
                EnableFunctionLevelLinking="true"
@@ -132,7 +136,9 @@
            />
            <Tool
                Name="VCLinkerTool"
+               AdditionalDependencies="glut32.lib"
                LinkIncremental="1"
+               AdditionalLibraryDirectories="d:\temp\glut\GL"
                GenerateDebugInformation="true"
                SubSystem="1"
                OptimizeReferences="2"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top