[vtkusers] Simple Linking Question

John Platt jcplatt at lineone.net
Thu Jan 20 19:12:59 EST 2005

Hi Mark,

If you are linking MFC as a static library, try compiling VTK & your MFC
app with the static CRT (/MT). From distant memory, the MFC static
library will link the static CRT which conflicts with the dynamic CRT
you have specified.



-----Original Message-----
From: Mark Wyszomierski [mailto:markww at gmail.com] 
Sent: 20 January 2005 20:31
To: John Platt
Subject: Re: [vtkusers] Simple Linking Question

Hi John,

I just recompiled VTK with these settings:

Use of MFC: Use MFC in a static library.
Runtime Library: Multi-threaded DLL (/MD)

Now 5 line test program uses the same exact settings. But I still get
the two linking errors complaining that new and new [] are already
defined! What could I be missing?

Here is my sophisticated test app again:

#include "vtkRenderer.h"
int main()
     vtkRenderer *renderer = vtkRenderer::New();
     return 0;

On Thu, 20 Jan 2005 09:07:58 -0000, John Platt <jcplatt at lineone.net>
> Hi Mark,
> Have you linked both VTK and your MFC app with the same C-runtime
> libraries? If you link your MFC app with Debug Multithreaded, the VTK
> libraries that you link should also have been built Debug
> John.
> -----Original Message-----
> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On
> Behalf Of Mark Wyszomierski
> Sent: 19 January 2005 19:16
> To: vtkusers at vtk.org
> Subject: [vtkusers] Simple Linking Question
> Hi,
> First, please forgive me if this message has been posted twice, I
> tried sending it once before subscribing to the mailing list!
> I would like to use MFC in a static link of my project with VTK. I
> have compiled VTK using MFC statically linked. When I go to compile my
> sample application (also statically linked with MFC) I get two linking
> errors as follow:
> [code]
> #include "vtkRenderer.h"
> int main()
> {
>  vtkRenderer *renderer = vtkRenderer::New();
> }
> [/code]
> Errors:
> LNK 2005: __cdecl operator new(..) already defined in libcpmtd.lib
> LNK 2005: __cdecl operator new[](..) already defined in libcpmtd.lib
> Should I compile VTK using standard windows libraries to facilitate
> static linking in MFC in the final project?
> Thanks!
> Mark
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

More information about the vtkusers mailing list