[vtkusers] VTK & Qt - linux compilation question

Chris Kelly ckelly at cosine.nl
Wed Jul 23 18:26:39 EDT 2008


Hi Raashid,
I solved this problem recently so hopefully this will be of some use to you.
I am using linux also but it applies to Windows equally well I believe.

I will assume you have already got some simple Qt applications running from
tutorials. If you are making Qt/VTK projects you will need to let Qt take
care of the Makefile generation process. The following steps should help you
to do this.

1.) Set up the project as a QT project
 - Go to your project source folder and run the command 
qmake -project (this will create a file named  <sourcefolder>.pro in your
source folder... This should only be done once for any project.
 - Next generated the makefile by running the command
qmake (this will create a pretty big Makefile which you should not edit this
directly.)
This should be enough to get your Qt project compiling.

2.) Update your .pro file to work with VTK
Your .pro file is a simple file compared to the Makefile generated by Qt and
contains the basic instructions that Qt uses to generated the Makefile. You
will need to let Qt know where the includes and libs for vtk are. To do
this, edit your <sourcefolder>.pro file and add the relevant includes and
libraries:
 - The lines to edit are the ones beginning with...
INCLUDEPATH += your includes ... add your VTK includes here
LIBPATH += your libraries .. add your VTK libs to this line
 - Run qmake everytime you edit this file to update your Makefile
 - You can check your Makefile to make sure it adds the libraries and
includes as expected
 - Run the command make when you are done to compile the project

HTH,
/Chris Kelly



Raashid Baig-2 wrote:
> 
> I am trying to build a Qt application (Qt version 4.3.4) on linux, it will
> involve a bit of post processing with VTK(cvs branch). Both Qt and VTK are
> compiled from sources in my home directly and work properly when used
> independently.
> 
> I am new to Qt and C++ in general, can someone please tell me how to
> compile simple examples which use both Qt and VTK libraries(like given in
> VTK/Examples/GUI/Qt). What should be used qmake or cmake ?
> 
> Thanks in advance.
> Raashid
>  
> 
> _______________________________________________
> 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
> 
> 

-- 
View this message in context: http://www.nabble.com/VTK---Qt---linux-compilation-question-tp18603966p18621441.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list