[vtkusers] VTK5.0.1+VC compiling Errors

邵世锋 shifeng.s at 163.com
Wed Sep 13 01:42:29 EDT 2006


 

Hi,
I'am appreciate that you can help me to solve my problems:
1,When I compiled the follow code,there were 2 errors and 1 warning like this:
Linking...
LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
Debug/image1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
2,I had added the lib files to vc workplace:vtkzlib.lib,CommonCxxTests.lib,vtkCommon.lib,vtkDICOMParser.lib,and so on.
3,What's the problem did I have?
Here is my code:
#include "vtkBMPReader.h"
#include "vtkContourFilter.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkProperty.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkActor2D.h"
void main()
{
       //create an instance of the class vtkBMPReader
      vtkBMPReader *image = vtkBMPReader::New();
        image->SetFilePrefix("D://image//head"); 
        image->SetFilePattern("%s%d.bmp"); 
        image->SetFileNameSliceOffset(1);
        image->SetFileNameSliceSpacing(1);
        image->SetNumberOfScalarComponents(3);
        image->SetDataSpacing(0.4,0.4,10);
        image->SetDataOrigin(0,0,0);
        image->SetDataExtent(0,255,0,255,1,10); 
        image->Update();

   vtkContourFilter *contour=vtkContourFilter::New();
        contour->SetInput((vtkDataSet *)image->GetOutput());
     contour->SetValue(0,800);
    vtkPolyDataMapper *mapper=vtkPolyDataMapper::New();
        mapper->SetInput(contour->GetOutput()); 
    vtkActor *actor=vtkActor::New();
        actor->SetMapper(mapper);
     actor->GetProperty()->SetColor(0,0, .9412);

  
  vtkRenderer *render=vtkRenderer::New();
        render->AddActor(actor);
  vtkRenderWindow *renwin=vtkRenderWindow::New();
        renwin->AddRenderer(render);
  vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renwin);
     renwin->Render();
     iren->Start();
     // CDialog::OnOK();
}
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060913/76584e53/attachment.htm>


More information about the vtkusers mailing list