[vtkusers] building vtkMFC as a static library (Visual studio 2008)

Mark Gooding mark.gooding at gmail.com
Wed Sep 2 04:35:18 EDT 2009


2009/9/1 John Drescher <drescherjm at gmail.com>:

> I would suggest using cmake to generate your project files for visual
> studio for your main application. It is much easier handling all the
> needed dependencies that way and it also adds functionality to the
> project.
> ...

if it makes my life easier I've no real objection to using cmake, but
it would need me to learn that. How steep is the learning curve?

> If you do not want to go this way. Take a look at each unresolved
> external and google a few to determine what library needs to be added.
> This is not as hard as it seems.

Turned out to be project configurations rather than missing libraries.
My MFC project was set to 32bit and vtk was compiled as 64bit. After
fixing that I now get different (and even more exciting?) errors...
all 1724 of them... all LNK2005 errors "blah blah is already defined".

>From searching the web, and this list, I see that these are often
realated to project configurations also. I've attempted to copy the
vtkDLG (MFC) project from the examples. The example project generated
by cmake builds fine, so I figure that if I copied that as far as
possible I might find what setting I had wrong.

My vtkMFCDLG project is happy to compile the project and link to VTK
until the point when I include the line:

pvtkMFCWindow = new vtkMFCWindow(this->GetDlgItem(IDC_MAINVTKWINDOW));

when all the LNK2005 errors occur.

As far as I can see I have the same project settings. Am I missing
something obvious? I'm sure building and linking to VTK really
shouldn't be this hard.

Mark



More information about the vtkusers mailing list