[vtkusers] Linker error in managed C++

Oliver Moss o.moss at eprosoft.de
Thu May 29 07:10:37 EDT 2003


Hello,

I have found the right settings for a mixed managed C++ program with vtk.
These are my compiler and linker settings for Visual Studio.NET 2003 (debug
mode):
Compiler:
/Od /I "D:\vtk-bin_4.2.2power" /I "D:\VTK-4.2.2\Common" /I
"D:\VTK-4.2.2\Filtering" /I "D:\VTK-4.2.2\Graphics" /I
"D:\VTK-4.2.2\Imaging" /I "D:\VTK-4.2.2\IO" /I "D:\VTK-4.2.2\Rendering" /AI
"d:\Eigene Dateien\Visual Studio Projects\TriPoint\PowerCrust\\Debug" /D
"WIN32" /D "_DEBUG" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MTd /GS /Gy /GR
/Yu"stdafx.h" /Fp"Debug/TriPowerCrust.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb"
/W3 /nologo /c /Zi /clr /TP /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll" /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"

Linker:
/OUT:"d:\Eigene Dateien\Visual Studio
Projects\TriPoint\PowerCrust\\Debug\TriPowerCrust.dll" /INCREMENTAL:NO
/NOLOGO /LIBPATH:"D:\vtk-bin_4.2.2power\bin\debug" /DLL
/INCLUDE:"__DllMainCRTStartup at 12" /DEBUG /ASSEMBLYDEBUG /PDB:"d:\Eigene
Dateien\Visual Studio Projects\TriPoint\PowerCrust\\Debug/TriPowerCrust.pdb"
/MACHINE:X86 /FIXED:No mscoree.lib vtkCommon.lib vtkFiltering.lib
vtkGraphics.lib vtkImaging.lib vtkIO.lib vtkRendering.lib MSVCRTD.LIB
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
"\vtk-bin_4.2.2power\bin\debug\vtkCommon.lib"
"\vtk-bin_4.2.2power\bin\debug\vtkFiltering.lib"
"\vtk-bin_4.2.2power\bin\debug\vtkGraphics.lib"
"\vtk-bin_4.2.2power\bin\debug\vtkImaging.lib"
"\vtk-bin_4.2.2power\bin\debug\vtkIO.lib"
"\vtk-bin_4.2.2power\bin\debug\vtkRendering.lib"

See you,

Oliver

Oliver Moss wrote:
> Hello Guys,
>
> I have invested a lot of hours in finding an error in the following
> code.
> Maybe, someone has an idea what could be wrong....
>
> The environment:
> Visual Studio.NET 2003, managed C++ and unmanged libs (the vtkLibrary
> 4.2.2).
> I added the libs and include the path to header files both in the
> same way.
>
> This sample does nothing, but it could be compiled and linked well
> (Win32
> Console, not managed):
>
> #include "stdafx.h"
> #include "vtkPolyData.h"
> int _tmain(int argc, _TCHAR* argv[])
> {
>     vtkPolyData *profile = vtkPolyData :: New ();
>     return 0;
> }
>
> And this sample produces a linker error (.NET Assembly):
> #pragma once
> #using <mscorlib.dll>
> using namespace System::Runtime::InteropServices;
> using namespace System;
> namespace PowerCrust
> {
>     public __gc class TriPointPowerCrust
>     {
>         // TODO: Add your methods for this class here.
>         public:
>         bool DoPowerCrust(void)
>         {
>             vtkPolyData *profile = vtkPolyData :: New ();
>             return true;
>         }
>     };
> }
>
> This is the error I get:
>
> Linking...
> LINK : error LNK2020: unresolved token (0A000013) _CxxThrowException
> LINK :
> error LNK2020: unresolved token (0A000024) delete LINK : fatal error
> LNK1120: 2 unresolved externals
>
> Any idea?
>
> Thank you very much,
>
> Oliver
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq> Follow this link to
> subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers





More information about the vtkusers mailing list