[vtkusers] Undefined reference using CygWin+VTK+wxWidgets+wxVTK

jonas jonas.email at gmail.com
Thu Jul 27 10:58:58 EDT 2006


I'm trying to compile the wxVTK package, but gets a linking error when linking
Sample.exe when running make. This is my configuration:

- VTK 4.4.2 compiled and installed in four different configurations (debug,
debug+static, release and release+static) in /usr/local/
- wxWidgets 2.6.3 alsp compiled and installed in four different configurations
(debug, debug+static, release and release+static) in /usr/local/
- ccmake version 2.2-patch 3
- All using the latest CygWin in WindowsXP

I get five (one for each sample in wxVTK) warnings when generating in ccmake:

Warning: Ignoring path found in link libraries for target: Sample, the path is :
/usr/local/lib. Expected a library name or full path to a library name.

It all compiles but when linking Sample.exe I get a lot of 'undefined reference'
(one of them is 'undefined reference to `wxClassInfo::Register()´).

I've tried forcing the linker flags to the output of `wx-config --libs´ with no
success:

CMAKE_EXE_LINKER_FLAGS:STRING=-L/usr/local/lib -lwx_msw_xrc-2.6 -lwx_msw_qa-2.6
-lwx_msw_html-2.6 -lwx_msw_adv-2.6 -lwx_msw_core-2.6 -lwx_base_xml-2.6
-lwx_base_net-2.6 -lwx_base-2.6

The only progress I could make was to add the linking info directly into
CMakeFiles/Sample.dir/build.make but this isn't nice coding:

bin/Sample.exe: CMakeFiles/Sample.dir/build.make
    @echo "Linking CXX executable bin/Sample.exe"
    $(CMAKE_COMMAND) -E remove -f bin/Sample.exe
    c++    -Wno-deprecated -mwin32  -L/usr/local/lib -lwx_msw_xrc-2.6
-lwx_msw_qa-2.6 -lwx_msw_html-2.6 -lwx_msw_adv-2.6 -lwx_msw_core-2.6
-lwx_base_xml-2.6 -lwx_base_net-2.6 -lwx_base-2.6  $(Sample_OBJECTS)
$(Sample_EXTERNAL_OBJECTS)  -o bin/Sample.exe  -L/cygdrive/c/apps/wxVTK/bin
-L/usr/lib/w32api -L/usr/local/lib/vtk -lvtkIO -lvtkHybrid -lvtkCommon
-lvtkGraphics -lvtkRendering -lcomctl32 -lrpcrt4 -lwsock32 -lopengl32 -lglu32
-lvtkGraphics -lvtkImaging -lvtkIO -lvtkFiltering -lvtkCommon -lpthread -lgdi32
-lm -lvtkDICOMParser -lvtkpng -lvtktiff -lvtkzlib -lvtkjpeg -lvtkexpat -lvtkftgl
-lvtkfreetype -lglu32 -lopengl32


So my final question is; how do i solve the linking problem to wxWidget?


This is the CMakeCache file in the wxVTK directory

---------------------------------------------------------------------
# This is the CMakeCache file.
# For build in directory: /cygdrive/c/apps/wxVTK
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.

########################
# EXTERNAL cache entries
########################

//Library is used for debug links only
/cygdrive/c/apps/wxWidgets-2.6.3/build-static-debug_LINK_TYPE:STATIC=debug

//Library is used for debug links only
/cygdrive/c/apps/wxWidgets-2.6.3/build-static-release/lib_LINK_TYPE:STATIC=optim

//Library is used for debug links only
/cygdrive/c/apps/wxWidgets-2.6.3/build-static-release_LINK_TYPE:STATIC=optimized

//Library is used for both debug and optimized links
/usr/local/lib_LINK_TYPE:STATIC=general

//Path to a program.
CMAKE_AR:FILEPATH=/usr/bin/ar

//For backwards compatibility, what version of CMake commands and
// syntax should this version of CMake allow.
CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.2

//Build type imported from VTK.
CMAKE_BUILD_TYPE:STRING=CMAKE_CXX_FLAGS_RELEASE

//C++ compiler
CMAKE_CXX_COMPILER:STRING=c++

//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING=

//Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=-g

//Flags used by the compiler during release minsize builds.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

//Flags used by the compiler during Release with Debug Info builds.
//
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g

//C compiler
CMAKE_C_COMPILER:STRING=gcc

//Flags for C compiler.
CMAKE_C_FLAGS:STRING=

//Flags used by the compiler during debug builds.
CMAKE_C_FLAGS_DEBUG:STRING=-g

//Flags used by the compiler during release minsize builds.
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

//Flags used by the compiler during Release with Debug Info builds.
//
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g

//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=-L/usr/local/lib -lwx_msw_xrc-2.6 -lwx_msw_qa-2.6
-lwx_msw_html-2.6 -lwx_msw_adv-2.6 -lwx_msw_core-2.6 -lwx_base_xml-2.6
-lwx_base_net-2.6 -lwx_base-2.6

//Flags used by the linker during debug builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=

//Flags used by the linker during release minsize builds.
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=

//Flags used by the linker during release builds.
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=

//Flags used by the linker during Release with Debug Info builds.
//
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=

//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local

//Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make

//Flags used by the linker during the creation of modules.
CMAKE_MODULE_LINKER_FLAGS:STRING=

//Flags used by the linker during debug builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=

//Flags used by the linker during release minsize builds.
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=

//Flags used by the linker during release builds.
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=

//Flags used by the linker during Release with Debug Info builds.
//
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=

//Path to a program.
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib

//Flags used by the linker during the creation of dll's.
CMAKE_SHARED_LINKER_FLAGS:STRING=

//Flags used by the linker during debug builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=

//Flags used by the linker during release minsize builds.
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=

//Flags used by the linker during release builds.
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=

//Flags used by the linker during Release with Debug Info builds.
//
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=

//If set, runtime paths are not added when using shared libraries.
//
CMAKE_SKIP_RPATH:BOOL=OFF

//If true, cmake will use relative paths in makefiles and projects.
//
CMAKE_USE_RELATIVE_PATHS:BOOL=OFF

//If this value is on, makefiles will be generated without the
// .SILENT directive, and all commands will be echoed to the console
// during the make.  This is useful for debugging only. With Visual
// Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=OFF

//Single output directory for building all executables.
EXECUTABLE_OUTPUT_PATH:PATH=/cygdrive/c/apps/wxVTK/bin

//Single output directory for building all libraries.
LIBRARY_OUTPUT_PATH:PATH=/cygdrive/c/apps/wxVTK/bin

//The directory containing VTKConfig.cmake.  This is either the
// root of the build tree, or PREFIX/lib/vtk for an installation.
//  For VTK 4.0, this is the location of UseVTK.cmake.  This is
// either the root of the build tree or PREFIX/include/vtk for
// an installation.
VTK_DIR:PATH=/usr/local/lib/vtk

//What is the path where the file wx/wx.h can be found
WXWINDOWS_INCLUDE_DIR:PATH=/usr/local/include/wx-2.6

//What is the path where the file wx/setup.h can be found
WXWINDOWS_INCLUDE_DIR_SETUPH:PATH=/usr/local/lib/wx/include/msw-ansi-debug-2.6

//What is the path where the file include/wx/wx.h can be found
WXWINDOWS_ROOT_DIR:PATH=/usr/local/lib/wx

//Set additional defines for wxWindows
WXWINDOWS_SET_DEFINITIONS:BOOL=OFF

//wxWindows shared debug build library
WXWINDOWS_SHARED_DEBUG_LIBRARY:FILEPATH=/usr/local/lib

//wxWindows shared release build library
WXWINDOWS_SHARED_LIBRARY:FILEPATH=/usr/local/lib

//wxWindows static debug build library
WXWINDOWS_STATIC_DEBUG_LIBRARY:FILEPATH=/usr/local/lib

//wxWindows static release build library
WXWINDOWS_STATIC_LIBRARY:FILEPATH=/usr/local/lib

//Use shared versions (dll) of wxWindows libraries?
WXWINDOWS_USE_SHARED_LIBS:BOOL=ON

//Value Computed by CMake
wxVTKSample_BINARY_DIR:STATIC=/cygdrive/c/apps/wxVTK

//Value Computed by CMake
wxVTKSample_SOURCE_DIR:STATIC=/cygdrive/c/apps/wxVTK


########################
# INTERNAL cache entries
########################

//Advanced flag for variable: CMAKE_AR
CMAKE_AR-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_BUILD_TOOL
CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1
//What is the target build tool cmake is generating for.
CMAKE_BUILD_TOOL:INTERNAL=/usr/bin/make
//This is the directory where this CMakeCahe.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=/cygdrive/c/apps/wxVTK
//Major version of cmake used to create the current loaded cache
//
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2
//Minor version of cmake used to create the current loaded cache
//
CMAKE_CACHE_MINOR_VERSION:INTERNAL=2
//Major version of cmake used to create the current loaded cache
//
CMAKE_CACHE_RELEASE_VERSION:INTERNAL=patch 3
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
//Advanced flag for variable: CMAKE_CXX_COMPILER
CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
//full path to the compiler cmake found
CMAKE_CXX_COMPILER_FULLPATH:INTERNAL=/usr/bin/c++
CMAKE_CXX_COMPILER_WORKS:INTERNAL=1
//Advanced flag for variable: CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_C_COMPILER
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
//full path to the compiler cmake found
CMAKE_C_COMPILER_FULLPATH:INTERNAL=/usr/bin/gcc
CMAKE_C_COMPILER_WORKS:INTERNAL=1
//Advanced flag for variable: CMAKE_C_FLAGS
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//Path to cache edit program executable.
CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake
//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//Modified flag for variable: CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS-MODIFIED:INTERNAL=1
//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
//
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
//
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
//Start directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=/cygdrive/c/apps/wxVTK
//Advanced flag for variable: CMAKE_MAKE_PROGRAM
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
//
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
//
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
//
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//number of local generators
CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=1
//Advanced flag for variable: CMAKE_RANLIB
CMAKE_RANLIB-ADVANCED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=/usr/share/cmake-2.2.3
//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
//
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
//
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
//
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//Result of TRY_RUN
CMAKE_SIZEOF_VOID_P:INTERNAL=4
//Advanced flag for variable: CMAKE_SKIP_RPATH
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
//uname command
CMAKE_UNAME:INTERNAL=/usr/bin/uname
//Advanced flag for variable: CMAKE_USE_RELATIVE_PATHS
CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1
//Advanced flag for variable: CMAKE_VERBOSE_MAKEFILE
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
//Advanced flag for variable: EXECUTABLE_OUTPUT_PATH
EXECUTABLE_OUTPUT_PATH-ADVANCED:INTERNAL=1
//Result of TRY_COMPILE
HAVE_CMAKE_SIZEOF_VOID_P:INTERNAL=TRUE
//Advanced flag for variable: LIBRARY_OUTPUT_PATH
LIBRARY_OUTPUT_PATH-ADVANCED:INTERNAL=1
//Path to an executable
Sample_CMAKE_PATH:INTERNAL=/cygdrive/c/apps/wxVTK
//Path to an executable
SplitSample_CMAKE_PATH:INTERNAL=/cygdrive/c/apps/wxVTK
//Modified flag for variable: VTK_DIR
VTK_DIR-MODIFIED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_INCLUDE_DIR
WXWINDOWS_INCLUDE_DIR-ADVANCED:INTERNAL=1
//Modified flag for variable: WXWINDOWS_INCLUDE_DIR
WXWINDOWS_INCLUDE_DIR-MODIFIED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_INCLUDE_DIR_SETUPH
WXWINDOWS_INCLUDE_DIR_SETUPH-ADVANCED:INTERNAL=1
//Modified flag for variable: WXWINDOWS_INCLUDE_DIR_SETUPH
WXWINDOWS_INCLUDE_DIR_SETUPH-MODIFIED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_ROOT_DIR
WXWINDOWS_ROOT_DIR-ADVANCED:INTERNAL=1
//Modified flag for variable: WXWINDOWS_ROOT_DIR
WXWINDOWS_ROOT_DIR-MODIFIED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_SET_DEFINITIONS
WXWINDOWS_SET_DEFINITIONS-ADVANCED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_SHARED_DEBUG_LIBRARY
WXWINDOWS_SHARED_DEBUG_LIBRARY-ADVANCED:INTERNAL=1
//Modified flag for variable: WXWINDOWS_SHARED_DEBUG_LIBRARY
WXWINDOWS_SHARED_DEBUG_LIBRARY-MODIFIED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_SHARED_LIBRARY
WXWINDOWS_SHARED_LIBRARY-ADVANCED:INTERNAL=1
//Modified flag for variable: WXWINDOWS_SHARED_LIBRARY
WXWINDOWS_SHARED_LIBRARY-MODIFIED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_STATIC_DEBUG_LIBRARY
WXWINDOWS_STATIC_DEBUG_LIBRARY-ADVANCED:INTERNAL=1
//Modified flag for variable: WXWINDOWS_STATIC_DEBUG_LIBRARY
WXWINDOWS_STATIC_DEBUG_LIBRARY-MODIFIED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_STATIC_LIBRARY
WXWINDOWS_STATIC_LIBRARY-ADVANCED:INTERNAL=1
//Modified flag for variable: WXWINDOWS_STATIC_LIBRARY
WXWINDOWS_STATIC_LIBRARY-MODIFIED:INTERNAL=1
//Advanced flag for variable: WXWINDOWS_USE_SHARED_LIBS
WXWINDOWS_USE_SHARED_LIBS-ADVANCED:INTERNAL=1
//Modified flag for variable: WXWINDOWS_USE_SHARED_LIBS
WXWINDOWS_USE_SHARED_LIBS-MODIFIED:INTERNAL=1
//Path to an executable
wxImagePlaneWidget_CMAKE_PATH:INTERNAL=/cygdrive/c/apps/wxVTK
//Path to an executable
wxImageViewer_CMAKE_PATH:INTERNAL=/cygdrive/c/apps/wxVTK
//Path to an executable
wxMedical3_CMAKE_PATH:INTERNAL=/cygdrive/c/apps/wxVTK
-------------------------




More information about the vtkusers mailing list