[IM, wxWidgets, CMake] Problems with linking.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Piniu

[IM, wxWidgets, CMake] Problems with linking.

Post by Piniu »

Hello!

I need to use ImageMagick library in small wxWidgets project and i'm trying to use CMake to set up project for Visual Studio Express 2008. I'm new in both CMake and ImageMagick as a library.

IM and wxWidgets are compiled as static libraries (yes, i want to use static linking and one exe without tons of dlls).

My CMakeList looks like this:

Code: Select all

cmake_minimum_required(VERSION 2.8)
project(ImageConverter)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
set(MY_MAGICK_PATH "D:/libraries/ImageMagick-6.5.9/")
set(MY_MAGICK_LIB_PATH "D:/libraries/ImageMagick-6.5.9/VisualMagick/lib")
find_package(wxWidgets COMPONENTS core base REQUIRED)
include_directories(${wxWidgets_INCLUDE_DIRS}
                    ${MY_MAGICK_PATH}
                    ${MY_MAGICK_PATH}/magick
                    ${MY_MAGICK_PATH}/Magick++
                    ${MY_MAGICK_PATH}/Magick++/lib)
add_definitions(${wxWidgets_DEFINITIONS})
set(SRCS ${PROJECT_SOURCE_DIR}/ImageConverter/sources/ImageConverter.cpp)
add_executable(ImageConverter WIN32 ${SRCS})
target_link_libraries(ImageConverter ${wxWidgets_LIBRARIES}
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_bzlib_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_coders_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_filters_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_jbig_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_jp2_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_jpeg_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_lcms_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_libxml_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_magick_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_Magick++_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_png_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_tiff_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_ttf_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_wand_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_wmf_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_xlib_.lib
                        ${MY_MAGICK_LIB_PATH}/CORE_RL_zlib_.lib
                        ${MY_MAGICK_LIB_PATH}/X11.lib
                        ${MY_MAGICK_LIB_PATH}/Xext.lib)
When compiling i get some warnings in Drawable.h (one example below):
2>d:\libraries\imagemagick-6.5.9\magick++\lib\Magick++/Drawable.h(456) : warning C4251: 'Magick::DrawableBezier::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::DrawableBezier'
2> with
2> [
2> _Ty=Magick::Coordinate
2> ]

...and finally linker cries:
2>ImageConverter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl Magick::InitializeMagick(char const *)" (__imp_?InitializeMagick@Magick@@YAXPBD@Z) referenced in function "public: virtual bool __thiscall MyApp::OnInit(void)" (?OnInit@MyApp@@UAE_NXZ)
2>G:\RentACoder\ImageConversionTool\ImageConverter\Project\Release\ImageConverter.exe : fatal error LNK1120: 1 unresolved externals

Can someone point me what im doing wrong?
Post Reply