[vtkusers] error LNK2019: unresolved external symbol "public: class vtkCamera * __thiscall vtkRenderer::GetActiveCamera(void)"
Carl Trapani
carl at skytopsoftware.com
Wed Jul 23 12:18:06 EDT 2008
Hi everyone,
Yes, I can run the examples that CMake/VC++ created in my CMake binary
(build) directory, like
C:\projects\vtk-5.0.4\VTKBuild-MsVS9\bin\Debug\Cone.exe. Additionally,
when I open VTK.sln in Visual Studio, I can "build" the RUN_TESTS
project and all tests pass and I can see windows with 3D objects opening
and closing.
1) What type of Visual Studio project did you create, a "Win32 Console
Application"?
2) The code that worked for you was the full Cone.cpp file or just the
simplified one?
3) How can I tell what libraries a class/header file is built into? How
do I know that vtkConeSource is in vtkrendering.lib (or is it)? What
about vtkCamera
I initially created an "Empty Project" and then, right clicked on Source
Files and "Add New Item" and selected "C++ File (.cpp)". Then I copy and
pasted the Cone.cxx code into the new C++ file.
I've also tried to create a Win32 Console Application (which generates
and includes stdafx.h and stdafx.cpp) with the libraries dependencies
you list below, but I'm still getting the same link errors with
vtkrendering.lib:
1>Linking...
1>LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of
other libs; use /NODEFAULTLIB:library
1>vtkrendering.lib(vtkOpenGLTexture.obj) : error LNK2019: unresolved
external symbol __imp__glDeleteTextures at 8 referenced in function
"public: virtual void __thiscall
vtkOpenGLTexture::ReleaseGraphicsResources(class vtkWindow *)"
(?ReleaseGraphicsResources at vtkOpenGLTexture@@UAEXPAVvtkWindow@@@Z)
1>vtkrendering.lib(vtkOpenGLImageActor.obj) : error LNK2001: unresolved
external symbol __imp__glDeleteTextures at 8
1>vtkrendering.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2001:
unresolved external symbol __imp__glDeleteTextures at 8
1>vtkrendering.lib(vtkOpenGLImageActor.obj) : error LNK2001: unresolved
external symbol __imp__glDisable at 4
....blah blah
This is killing me!
Anyone have any thoughts?
Carl
-------- Original Message --------
Subject: RE: [vtkusers] error LNK2019: unresolved external symbol
"public: class vtkCamera * __thiscall vtkRenderer::GetActiveCamera(void)"
Date: Wed, 23 Jul 2008 17:16:15 +0200
From: Frederic DANESI <frederic.danesi at dinccs.com>
Organization: DINCCS
To: 'Carl Trapani' <carl at skytopsoftware.com>
References: <48862F43.3010502 at skytopsoftware.com>
<001501c8ec3d$f6492c90$e2db85b0$@danesi at dinccs.com>
<488743E8.7060700 at skytopsoftware.com>
Hi Carl,
Obviously, you can forward my message, It was a mistake to reply only at
you, I usually reply to all ...
Anyway, I tried to make a new project with you code.
I added to the project dependencies :
vtkrendering.lib
vtkcommon.lib
vtkIo.lib
vtkfiltering.lib
vtkGraphics.lib
vtkHybrid.lib
vtkImaging.lib
and included stdafx.h
and everything is OK ...
Before trying to get your own program running, did you try to run the
testing ones (the examples embedded in VTK) ?
It is just a shot to be sure that your VTK environment is not corrupt, but I
don't see here anything wrong ...
Sorry to be useless :-(
Fred.
Cordialement,
F.Danesi
> -----Message d'origine-----
> De : Carl Trapani [mailto:carl at skytopsoftware.com]
> Envoyé : mercredi 23 juillet 2008 16:45
> À : Frederic DANESI
> Objet : Re: [vtkusers] error LNK2019: unresolved external symbol
> "public: class vtkCamera * __thiscall
> vtkRenderer::GetActiveCamera(void)"
>
> Hi Fred,
>
> Thanks very much for your help. Your instructions were easy to follow
> :-) and they have helped fix my problem (I think), but I'm still having
> some link problems that I'm wondering if you could help with?
>
> I simplified the Cone.cxx example to the following:
>
> ////////////////////////////////////////////////////
> #include "vtkConeSource.h"
>
> int main()
> {
> vtkConeSource *cone = vtkConeSource::New();
> cone->Delete();
> }
> ////////////////////////////////////////////////////
>
> Now, I'm thinking, how can I tell which library a class (vtkConeSource)
> is packaged in?
>
> For now, I just listed all the libraries in my VTK install for Project
> -> Properties -> Configuration Properties -> Linker -> Input ->
> Additional Dependencies:
>
> vtkCommon.lib
> vtkDICOMParser.lib
> vtkexoIIc.lib
> vtkexpat.lib
> vtkFiltering.lib
> vtkfreetype.lib
> vtkftgl.lib
> vtkGenericFiltering.lib
> vtkGraphics.lib
> vtkHybrid.lib
> vtkImaging.lib
> vtkIO.lib
> vtkjpeg.lib
> vtkNetCDF.lib
> vtkpng.lib
> vtkRendering.lib
> vtksys.lib
> vtktiff.lib
> vtkVolumeRendering.lib
> vtkWidgets.lib
> vtkzlib.lib
>
> with the additional inherited values:
>
> kernel32.lib
> user32.lib
> gdi32.lib
> winspool.lib
> comdlg32.lib
> advapi32.lib
> shell32.lib
> ole32.lib
> oleaut32.lib
> uuid.lib
> odbc32.lib
> odbccp32.lib
>
> This works for the simplified code above (HelloVtk.cpp) with some
> warnings, but it compiles and links!
>
> 1>------ Build started: Project: Cones, Configuration: Debug Win32 ----
> --
> 1>Compiling...
> 1>HelloVtk.cpp
> 1>Generating Code...
> 1>Linking...
> 1>LINK : C:\Users\Carl\Documents\Visual Studio
> 2008\Projects\VTKExamples\Debug\Cones.exe not found or not built by the
> last incremental link; performing full link
> 1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of
> other libs; use /NODEFAULTLIB:library
> 1>Embedding manifest...
> 1>Build log was saved at "file://c:\Users\Carl\Documents\Visual Studio
> 2008\Projects\VTKExamples\Cones\Debug\BuildLog.htm"
> 1>Cones - 0 error(s), 1 warning(s)
> ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped
> ==========
>
> But, when I try and build the full Cone.cpp example (attached), with
> same project properties (all libs listed for linking), I get unresolved
> external symbol problems with vtkRendering.lib and vtkOpenGL*.obj:
>
> 1>------ Build started: Project: Cones, Configuration: Debug Win32 ----
> --
> 1>Compiling...
> 1>Cone.cpp
> 1>HelloVtk.cpp
> 1>Generating Code...
> 1>Linking...
> 1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of
> other libs; use /NODEFAULTLIB:library
> 1>vtkRendering.lib(vtkOpenGLTexture.obj) : error LNK2019: unresolved
> external symbol __imp__glDeleteTextures at 8 referenced in function
> "public: virtual void __thiscall
> vtkOpenGLTexture::ReleaseGraphicsResources(class vtkWindow *)"
> (?ReleaseGraphicsResources at vtkOpenGLTexture@@UAEXPAVvtkWindow@@@Z)
> 1>vtkRendering.lib(vtkOpenGLImageActor.obj) : error LNK2001: unresolved
> external symbol __imp__glDeleteTextures at 8
> 1>vtkRendering.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2001:
> unresolved external symbol __imp__glDeleteTextures at 8
> 1>vtkRendering.lib(vtkOpenGLImageActor.obj) : error LNK2001: unresolved
> external symbol __imp__glDisable at 4
> 1>vtkRendering.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2001:
> unresolved external symbol __imp__glDisable at 4
> 1>vtkRendering.lib(vtkOpenGLRenderWindow.obj) : error LNK2001:
> unresolved external symbol __imp__glDisable at 4
> ...
> .... blah blah blah ......
> ...
> 1>C:\Users\Carl\Documents\Visual Studio
> 2008\Projects\VTKExamples\Debug\Cones.exe : fatal error LNK1120: 82
> unresolved externals
> 1>Build log was saved at "file://c:\Users\Carl\Documents\Visual Studio
> 2008\Projects\VTKExamples\Cones\Debug\BuildLog.htm"
> 1>Cones - 136 error(s), 1 warning(s)
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
> ==========
>
> Any thoughts?
>
> Also, do you mind if I post back your helpful comments below to the
> vtkusers list?
>
> Thanks again!
> Carl Trapani
>
>
> Frederic DANESI wrote:
> > I guess that you provide the compiler with the correct path to
> lib/headers
> > files ...
> > However, you have to specify which ones of the dll your program
> should be
> > linked to ...
> > For me (sorry if this is not exactly the correct terms, my
> installation is a
> > French one so I try to translate the menu titles ...), I have to open
> the
> > properties of my project, then select the configuration (release,
> debug) and
> > platform.
> > On the left tree, the second option is something like 'configuration
> > properties', which enclosed "general, debug, c/C++, linker, ...
> > Select "linker". Then, in the extended tree, you should have
> "general,
> > input, manifest, ..."
> > Select "Input".
> > Yhe first line on the right is 'additional dependencies" in which you
> should
> > already have odbc32.lib, kernel32.lib, user32.lib ...
> > On this line, you have to specify explicitly which library is used
> and
> > linked to your project : add vtkcommon.lib vtkrendering.lib,
> vtkio.lib ...
> > and everyone you need ...
> >
> > HTH
> > Fred.
> >
> > Cordialement,
> > F.Danesi
> >
More information about the vtkusers
mailing list