Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
799 views
in Technique[技术] by (71.8m points)

visual studio 2008 - Llinking ITK (Insight Toolkit) to C++ VS2008 solution without using CMake?

Question

Is there an easy, straight forward way of including the ITK libraries into my project (VS2008 solution) without using CMake?

Background

I have just started looking into ITK this week. So far I successfully compiled ITK & VTK and got the WikiExamples to compile (and run) as well. My next goal is to include any ITK functionality into my own project. I have no experiences with CMake except the use of it during the documented installation process.

My own project codebase is in itself a rather complicated, SDK environment in rather large, complex VS2008 solution to which I only want to add a bit of ITK functionality. As I have built ITK already, can I simply set includes to the .h files and add the lib directories to the linker?

Is there a good way to do this, as the .h files are spread over the whole ITK code tree?

I've realized that this question is similar, but the given answer was too cryptic for me, sorry.

Edit: After a 2nd and 3rd read, it actually wasn't. It led to my answer below.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When configuring ITK with CMake (or cmake-gui) one can set the variable CMAKE_INSTALL_PREFIX to a destination for all output. The default value is C:/Programm Files (x84)/itk

CMAKE-GUI setting up ITK build

After Configure and Generate have been performed successfully, the solution file (ITK.sln) has been created in the given "Where to build the binaries" directory and can be opened in Visual Studi0 2008. The solution has the default project ALL_BUILD which builds the solution, but it also has a INSTALL project which is skipped by default.

VS 2008 solution

Building this solution (after ALL_BUILD) copies all required lib, .h, .dll etc. files into the path specified before.

VS 2008 output after building INSTALL

This folder structure is the place to link my own project up to.

Final folder structure

Linking in your own project

In your own project of VS Studio (I'm on VS 2008) you have to modify your project properties to include the include files:

Adding include files

And you have to modify your project properties to include the library files for linking:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...