views:

231

answers:

2

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?

+1  A: 

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"
John Weldon
I'm working on a project handed down from a Japanese student who is no longer at the University. This is his portion of it. I'm not entirely sure. If you see anything that could be of use when you look at the project I would appreciate it!
Simucal
+4  A: 

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

karunski