[Insight-users] CMakeLists.txt and QT
Iordanescu, Gheorghe (CC/DRD)
GIordanescu@cc.nih.gov
Mon, 9 Sep 2002 21:55:27 -0400
Hello,
I am new to ITK and Cmake.
I work on a Windows machine (Win 2K, SP 2) with Visual C 6.0 (SP5). Here is
my problem:
I tried one example using the following CMakeLists.txt file:
-------------------------------------------------------
PROJECT(TESTPRJ)
INCLUDE_DIRECTORIES(
$(ITK_SOURCE_DIR)\
$(ITK_SOURCE_DIR)/Code/Common
$(ITK_SOURCE_DIR)/Code/IO
$(ITK_SOURCE_DIR)/Code/BasicFilters
$(ITK_SOURCE_DIR)/Code/Algorithms
$(ITK_SOURCE_DIR)/Code/Numerics/vxl
$(ITK_SOURCE_DIR)/Code/Numerics/vxl/vcl
)
LINK_DIRECTORIES(
$(ITK_SOURCE_DIR)\
$(ITK_SOURCE_DIR)/Code/Common
$(ITK_SOURCE_DIR)/Code/IO
$(ITK_BINARY_DIR)/Code/BasicFilters
$(ITK_BINARY_DIR)/Code/Algorithms
$(ITK_BINARY_DIR)/Code/Numerics/vxl
$(ITK_BINARY_DIR)/Utilities/png
$(ITK_BINARY_DIR)/Utilities/zlib
)
LINK_LIBRARIES (
ITKBasicFilters
ITKCommon
ITKIO
VXLNumerics
itkpng
itkzlib
)
ADD_EXECUTABLE(TESTPRJ triDOpening pgm_reader.cpp)
----------------------------------------------------------
In the same directory I have 5 files:
general.h, pgm_reader.cpp, pgm_reader.h, triDOpening.cxx
Everything worked great. I was able to build and run the generated dsp file
(I just loaded the dsw file in Visual C and it worked).
Next I wanted to do the same thing, except I wanted to have the dsp in a
different directory.
So I build the next structure:
someDir/src/ Morphology
In someDir I put the next CMakeLists.txt :
-------------------------------------------------------
PROJECT (ctccad)
SUBDIRS(
src/Morphology
)
INCLUDE_DIRECTORIES(
$(ITK_SOURCE_DIR)\
$(ITK_SOURCE_DIR)/Code/Common
$(ITK_SOURCE_DIR)/Code/IO
$(ITK_SOURCE_DIR)/Code/BasicFilters
$(ITK_SOURCE_DIR)/Code/Algorithms
$(ITK_SOURCE_DIR)/Code/Numerics/vxl
$(ITK_SOURCE_DIR)/Code/Numerics/vxl/vcl
)
LINK_DIRECTORIES(
$(ITK_SOURCE_DIR)\
$(ITK_SOURCE_DIR)/Code/Common
$(ITK_SOURCE_DIR)/Code/IO
$(ITK_BINARY_DIR)/Code/BasicFilters
$(ITK_BINARY_DIR)/Code/Algorithms
$(ITK_BINARY_DIR)/Code/Numerics/vxl
$(ITK_BINARY_DIR)/Utilities/png
$(ITK_BINARY_DIR)/Utilities/zlib
)
LINK_LIBRARIES (
ITKBasicFilters
ITKCommon
ITKIO
VXLNumerics
itkpng
itkzlib
)
-------------------------------------------------------
And in someDir \src\Morphology
I put the same files as above:
general.h, pgm_reader.cpp, pgm_reader.h, triDOpening.cxx
plus the next CMakeLists.txt :
ADD_EXECUTABLE(ctccad triDOpening pgm_reader)
When I tried to build the generated ctccad.dsw file I got the next error
messages:
--------------------Configuration: ctccad - Win32 Debug--------------------
Compiling...
pgm_reader.cpp
triDOpening.cxx
Generating Code...
Linking...
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: void __thiscall
std::basic_ifstream<char,struct std::char_traits<char> >::`vbase
destructor'(void)"
(??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined
in triDOpening.obj
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: void __thiscall
std::basic_ifstream<char,struct std::char_traits<char> >::close(void)"
(?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ) already
defined in triDOpening.obj
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: void __thiscall
std::basic_ifstream<char,struct std::char_traits<char> >::open(char const
*,int)" (?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDH@Z)
already defined in triDOpening.ob
j
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall
std::basic_ifstream<char,struct std::char_traits<char>
>::basic_ifstream<char,struct std::char_traits<char> >(void)"
(??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@XZ) already de
fined in triDOpening.obj
Debug/ctccad.exe : fatal error LNK1169: one or more multiply defined symbols
found
Error executing link.exe.
Also I would like to ask if anybody can provide me some examples of adding
compilation of QT files to cmake (I guess I should use QT_WRAP_CPP command).
Any help will be highly appreciated.
Thank you in advance,
George