[vtkusers] How to set path to vtk Library in Visual C++ .Net with Vtk
Henry Zhang
henry.zhang at ualberta.ca
Wed Jan 22 18:18:57 EST 2003
Hello, there,
Please help me to set the PATH to vtk library in Visual C++ .Net!
I tried to use Visual C++ .Net with Vtk. After setting a few
environment variables, I can compile the source code. However,
I have to use the #pragma comment( lib, "C:\\Program
Files\\vtk40\\lib\\vtk\\vtkCommon.lib" ) to
load library. I remember that when I use Visual C++ 6.0, I can go to
Project-->Settings to define the PATH to the "lib". I don't know where
to set it in Visual C++ .Net?
The following are my source code.
Regards,
Henry
#include "stdafx.h"
#include "qs.h"
#include "vtkConeSource.h"
#include "vtkSphereSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// The one and only application object
#pragma comment( lib, "C:\\Program Files\\vtk40\\lib\\vtk\\vtkCommon.lib" )
#pragma comment( lib, "C:\\Program
Files\\vtk40\\lib\\vtk\\vtkRendering.lib" )
#pragma comment( lib, "C:\\Program
Files\\vtk40\\lib\\vtk\\vtkGraphics.lib" )
#pragma comment( lib, "C:\\Program Files\\vtk40\\lib\\vtk\\vtkImaging.lib" )
#pragma comment( lib, "C:\\Program
Files\\vtk40\\lib\\vtk\\vtkFiltering.lib" )
#pragma comment( lib, "C:\\Program Files\\vtk40\\lib\\vtk\\vtkHybrid.lib" )
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
// create sphere geometry
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(1.0);
sphere->SetThetaResolution(18);
sphere->SetPhiResolution(18);
// vtkTextProperty tprop=new vtkTextProperty();
// map to graphics library
vtkPolyDataMapper *map = vtkPolyDataMapper::New();
map->SetInput(sphere->GetOutput());
// actor coordinates geometry, properties, transformation
vtkActor *aSphere = vtkActor::New();
aSphere->SetMapper(map);
aSphere->GetProperty()->SetColor(0,0,1); // sphere color blue
// a renderer and render window
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
// an interactor
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
// add the actor to the scene
ren1->AddActor(aSphere);
ren1->SetBackground(1,1,1); // Background color white
// render an image (lights and cameras are created automatically)
renWin->Render();
// begin mouse interaction
iren->Start();
}
return nRetCode;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030122/183debc9/attachment.htm>
More information about the vtkusers
mailing list