In my C++/WinRT project I use below MIDL code to declare an asynchronous method returning a Windows::Foundation::IInspectable object.
namespace myproject
{
[default_interface]
runtimeclass FileRetriever
{
FileRetriever();
Windows.Foundation.IAsyncOperation<Windows.Foundation.IInspectable> RetrieveFileNamesAsync();
}
}
The code gives the following error when compiling:
Error MIDL2011 [msg]unresolved type declaration [context]: Windows.Foundation.IInspectable [ parameterized interface parameter 'Windows.Foundation.IInspectable' of Procedure 'RetrieveFileNamesAsync' ( RuntimeClass 'myproject.FileRetriever' ) ]
MSDN states the error can be resolved by "add[ing] an import directive for the IDL file(s) that contain the definitions of any type(s) that you reference that you've defined in your project" but IInspectable is obviously not a type I defined myself.
How can I resolve the error?
I'm trying to build the package frequensea, but I'm having errors.
I edited CMakeCache.txt to fill in the path for required libraries and I was expecting not to have more obstacles to build the software.
However, this is the output from make:
sdr#sdr:/home/sdr/frequensea/build$ make
Scanning dependencies of target lua
[ 2%] Linking C static library liblua.a
[ 75%] Built target lua
Scanning dependencies of target frequensea
[ 77%] Building CXX object CMakeFiles/frequensea.dir/src/main.cpp.o
[ 79%] Building C object CMakeFiles/frequensea.dir/src/nfile.c.o
[ 81%] Building C object CMakeFiles/frequensea.dir/src/ngl.c.o
[ 83%] Building C object CMakeFiles/frequensea.dir/src/nim.c.o
[ 85%] Building C object CMakeFiles/frequensea.dir/src/noise.c.o
[ 87%] Building C object CMakeFiles/frequensea.dir/src/nosc.c.o
[ 89%] Building C object CMakeFiles/frequensea.dir/src/nrf.c.o
[ 91%] Building C object CMakeFiles/frequensea.dir/src/nut.c.o
[ 93%] Building C object CMakeFiles/frequensea.dir/src/nwm.c.o
[ 95%] Building C object CMakeFiles/frequensea.dir/src/obj.c.o
[ 97%] Building C object CMakeFiles/frequensea.dir/src/vec.c.o
[100%] Linking CXX executable frequensea
externals/lua/liblua.a(loslib.c.o): In function `os_tmpname':
/home/sdr/sdr/frequensea/externals/lua/src/loslib.c:140: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_check_compile_error':
/home/sdr/frequensea/src/ngl.c:80: undefined reference to `__glewGetShaderiv'
/home/sdr/frequensea/src/ngl.c:83: undefined reference to `__glewGetShaderInfoLog'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_check_link_error':
/home/sdr/frequensea/src/ngl.c:92: undefined reference to `__glewGetProgramiv'
/home/sdr/frequensea/src/ngl.c:95: undefined reference to `__glewGetProgramInfoLog'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_shader_new':
/home/sdr/frequensea/src/ngl.c:102: undefined reference to `__glewCreateShader'
/home/sdr/frequensea/src/ngl.c:103: undefined reference to `__glewShaderSource'
/home/sdr/frequensea/src/ngl.c:104: undefined reference to `__glewCompileShader'
/home/sdr/frequensea/src/ngl.c:108: undefined reference to `__glewCreateShader'
/home/sdr/frequensea/src/ngl.c:109: undefined reference to `__glewShaderSource'
/home/sdr/frequensea/src/ngl.c:110: undefined reference to `__glewCompileShader'
/home/sdr/frequensea/src/ngl.c:114: undefined reference to `__glewCreateProgram'
/home/sdr/frequensea/src/ngl.c:115: undefined reference to `__glewAttachShader'
/home/sdr/frequensea/src/ngl.c:116: undefined reference to `__glewAttachShader'
/home/sdr/frequensea/src/ngl.c:119: undefined reference to `__glewTransformFeedbackVaryings'
/home/sdr/frequensea/src/ngl.c:120: undefined reference to `__glewLinkProgram'
/home/sdr/frequensea/src/ngl.c:129: undefined reference to `__glewGetUniformLocation'
/home/sdr/frequensea/src/ngl.c:130: undefined reference to `__glewGetUniformLocation'
/home/sdr/frequensea/src/ngl.c:131: undefined reference to `__glewGetUniformLocation'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_shader_uniform_set_float':
/home/sdr/frequensea/src/ngl.c:146: undefined reference to `__glewUseProgram'
/home/sdr/frequensea/src/ngl.c:147: undefined reference to `__glewGetUniformLocation'
/home/sdr/frequensea/src/ngl.c:149: undefined reference to `__glewUniform1f'
/home/sdr/frequensea/src/ngl.c:151: undefined reference to `__glewUseProgram'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_shader_free':
/home/sdr/frequensea/src/ngl.c:155: undefined reference to `__glewDeleteShader'
/home/sdr/frequensea/src/ngl.c:156: undefined reference to `__glewDeleteShader'
/home/sdr/frequensea/src/ngl.c:157: undefined reference to `__glewDeleteProgram'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_texture_new':
/home/sdr/frequensea/src/ngl.c:170: undefined reference to `__glewActiveTexture'
/home/sdr/frequensea/src/ngl.c:179: undefined reference to `__glewGetUniformLocation'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_texture_update':
/home/sdr/frequensea/src/ngl.c:219: undefined reference to `__glewActiveTexture'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_model_new':
/home/sdr/frequensea/src/ngl.c:258: undefined reference to `__glewGenBuffers'
/home/sdr/frequensea/src/ngl.c:259: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:260: undefined reference to `__glewBufferData'
/home/sdr/frequensea/src/ngl.c:267: undefined reference to `__glewGenBuffers'
/home/sdr/frequensea/src/ngl.c:268: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:269: undefined reference to `__glewBufferData'
/home/sdr/frequensea/src/ngl.c:276: undefined reference to `__glewGenBuffers'
/home/sdr/frequensea/src/ngl.c:277: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:278: undefined reference to `__glewBufferData'
/home/sdr/frequensea/src/ngl.c:284: undefined reference to `__glewGenVertexArrays'
/home/sdr/frequensea/src/ngl.c:285: undefined reference to `__glewBindVertexArray'
/home/sdr/frequensea/src/ngl.c:288: undefined reference to `__glewEnableVertexAttribArray'
/home/sdr/frequensea/src/ngl.c:289: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:290: undefined reference to `__glewVertexAttribPointer'
/home/sdr/frequensea/src/ngl.c:295: undefined reference to `__glewEnableVertexAttribArray'
/home/sdr/frequensea/src/ngl.c:296: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:297: undefined reference to `__glewVertexAttribPointer'
/home/sdr/frequensea/src/ngl.c:302: undefined reference to `__glewEnableVertexAttribArray'
/home/sdr/frequensea/src/ngl.c:303: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:304: undefined reference to `__glewVertexAttribPointer'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_model_load_obj':
/home/sdr/frequensea/src/ngl.c:467: undefined reference to `__glewGenBuffers'
/home/sdr/frequensea/src/ngl.c:468: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:469: undefined reference to `__glewBufferData'
/home/sdr/frequensea/src/ngl.c:472: undefined reference to `__glewGenBuffers'
/home/sdr/frequensea/src/ngl.c:473: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:474: undefined reference to `__glewBufferData'
/home/sdr/frequensea/src/ngl.c:479: undefined reference to `__glewGenVertexArrays'
/home/sdr/frequensea/src/ngl.c:480: undefined reference to `__glewBindVertexArray'
/home/sdr/frequensea/src/ngl.c:481: undefined reference to `__glewEnableVertexAttribArray'
/home/sdr/frequensea/src/ngl.c:482: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:483: undefined reference to `__glewVertexAttribPointer'
/home/sdr/frequensea/src/ngl.c:484: undefined reference to `__glewEnableVertexAttribArray'
/home/sdr/frequensea/src/ngl.c:485: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:486: undefined reference to `__glewVertexAttribPointer'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_model_free':
/home/sdr/frequensea/src/ngl.c:498: undefined reference to `__glewDeleteBuffers'
/home/sdr/frequensea/src/ngl.c:499: undefined reference to `__glewDeleteBuffers'
/home/sdr/frequensea/src/ngl.c:500: undefined reference to `__glewDeleteBuffers'
/home/sdr/frequensea/src/ngl.c:501: undefined reference to `__glewDeleteVertexArrays'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_skybox_new':
/home/sdr/frequensea/src/ngl.c:620: undefined reference to `__glewGenBuffers'
/home/sdr/frequensea/src/ngl.c:621: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:622: undefined reference to `__glewBufferData'
/home/sdr/frequensea/src/ngl.c:624: undefined reference to `__glewGenVertexArrays'
/home/sdr/frequensea/src/ngl.c:625: undefined reference to `__glewBindVertexArray'
/home/sdr/frequensea/src/ngl.c:626: undefined reference to `__glewEnableVertexAttribArray'
/home/sdr/frequensea/src/ngl.c:627: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:628: undefined reference to `__glewVertexAttribPointer'
/home/sdr/frequensea/src/ngl.c:630: undefined reference to `__glewActiveTexture'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_skybox_draw':
/home/sdr/frequensea/src/ngl.c:652: undefined reference to `__glewUseProgram'
/home/sdr/frequensea/src/ngl.c:654: undefined reference to `__glewUniformMatrix4fv'
/home/sdr/frequensea/src/ngl.c:656: undefined reference to `__glewUniformMatrix4fv'
/home/sdr/frequensea/src/ngl.c:658: undefined reference to `__glewActiveTexture'
/home/sdr/frequensea/src/ngl.c:662: undefined reference to `__glewBindVertexArray'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_skybox_free':
/home/sdr/frequensea/src/ngl.c:671: undefined reference to `__glewDeleteBuffers'
/home/sdr/frequensea/src/ngl.c:672: undefined reference to `__glewDeleteVertexArrays'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `_ngl_draw_model':
/home/sdr/frequensea/src/ngl.c:689: undefined reference to `__glewUseProgram'
/home/sdr/frequensea/src/ngl.c:691: undefined reference to `__glewUniform1f'
/home/sdr/frequensea/src/ngl.c:693: undefined reference to `__glewUniformMatrix4fv'
/home/sdr/frequensea/src/ngl.c:695: undefined reference to `__glewUniformMatrix4fv'
/home/sdr/frequensea/src/ngl.c:698: undefined reference to `__glewBindVertexArray'
/home/sdr/frequensea/src/ngl.c:701: undefined reference to `__glewBeginTransformFeedback'
/home/sdr/frequensea/src/ngl.c:707: undefined reference to `__glewEndTransformFeedback'
/home/sdr/frequensea/src/ngl.c:711: undefined reference to `__glewBindVertexArray'
/home/sdr/frequensea/src/ngl.c:713: undefined reference to `__glewUseProgram'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_capture_model':
/home/sdr/frequensea/src/ngl.c:723: undefined reference to `__glewGenTransformFeedbacks'
/home/sdr/frequensea/src/ngl.c:726: undefined reference to `__glewGenBuffers'
/home/sdr/frequensea/src/ngl.c:728: undefined reference to `__glewBindTransformFeedback'
/home/sdr/frequensea/src/ngl.c:730: undefined reference to `__glewBindBuffer'
/home/sdr/frequensea/src/ngl.c:733: undefined reference to `__glewBufferData'
/home/sdr/frequensea/src/ngl.c:735: undefined reference to `__glewBindBufferBase'
/home/sdr/frequensea/src/ngl.c:743: undefined reference to `__glewGetBufferSubData'
/home/sdr/frequensea/src/ngl.c:748: undefined reference to `__glewDeleteBuffers'
/home/sdr/frequensea/src/ngl.c:750: undefined reference to `__glewDeleteTransformFeedbacks'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_font_new':
/home/sdr/frequensea/src/ngl.c:805: undefined reference to `__glewUseProgram'
/home/sdr/frequensea/src/ngl.c:807: undefined reference to `__glewGetUniformLocation'
/home/sdr/frequensea/src/ngl.c:809: undefined reference to `__glewGetUniformLocation'
/home/sdr/frequensea/src/ngl.c:811: undefined reference to `__glewUseProgram'
/home/sdr/frequensea/src/ngl.c:834: undefined reference to `__glewActiveTexture'
CMakeFiles/frequensea.dir/src/ngl.c.o: In function `ngl_font_draw':
/home/sdr/frequensea/src/ngl.c:903: undefined reference to `__glewUseProgram'
/home/sdr/frequensea/src/ngl.c:905: undefined reference to `__glewUniform2f'
/home/sdr/frequensea/src/ngl.c:907: undefined reference to `__glewUniform1f'
/home/sdr/frequensea/src/ngl.c:909: undefined reference to `__glewActiveTexture'
/home/sdr/frequensea/src/ngl.c:913: undefined reference to `__glewBindVertexArray'
/home/sdr/frequensea/src/ngl.c:918: undefined reference to `__glewBindVertexArray'
/home/sdr/frequensea/src/ngl.c:920: undefined reference to `__glewUseProgram'
collect2: error: ld returned 1 exit status
CMakeFiles/frequensea.dir/build.make:365: recipe for target 'frequensea' failed
make[2]: *** [frequensea] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/frequensea.dir/all' failed
make[1]: *** [CMakeFiles/frequensea.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I'm trying to build a simple SDL2 game with CMake and MSYS Makefiles.
I want to statically link SDL2 so I can distribute a single executable without having to include the SDL2.dll.
Here's my CMakeLists.txt file:
project(racer-sdl)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_EXE_LINKER_FLAGS "-static")
include(FindPkgConfig)
pkg_search_module(SDL2 sdl2)
if (SDL2_FOUND)
message(STATUS "Using SDL2")
add_definitions(-DUSE_SDL2)
include_directories(${SDL2_INCLUDE_DIRS})
link_directories(${SDL2_LIBRARY_DIRS})
link_libraries(${SDL2_LIBRARIES})
else ()
message(FATAL_ERROR "Missing SDL2")
endif ()
file(GLOB SOURCE_FILES src/*.cpp src/*.hpp)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES})
I can build fine without the -static linker flag, but with it I get long list of undefined references.
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `timeSetPeriod':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:58: undefined reference to `_imp__timeBeginPeriod#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:52: undefined reference to `_imp__timeEndPeriod#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:58: undefined reference to `_imp__timeBeginPeriod#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `SDL_TicksInit':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:106: undefined reference to `_imp__timeGetTime#0'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `timeSetPeriod':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:52: undefined reference to `_imp__timeEndPeriod#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:52: undefined reference to `_imp__timeEndPeriod#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `SDL_GetTicks_REAL':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:159: undefined reference to `_imp__timeGetTime#0'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `timeSetPeriod':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:58: undefined reference to `_imp__timeBeginPeriod#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `SDL_TicksInit':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:106: undefined reference to `_imp__timeGetTime#0'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `timeSetPeriod':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:52: undefined reference to `_imp__timeEndPeriod#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `SDL_GetTicks_REAL':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:159: undefined reference to `_imp__timeGetTime#0'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `timeSetPeriod':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:58: undefined reference to `_imp__timeBeginPeriod#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `SDL_TicksInit':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:106: undefined reference to `_imp__timeGetTime#0'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_systimer.o): In function `timeSetPeriod':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c:52: undefined reference to `_imp__timeEndPeriod#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_SetupAPI':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:596: undefined reference to `ImmGetIMEFileNameA#12'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:609: undefined reference to `ImmGetContext#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:612: undefined reference to `ImmReleaseContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetId':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:530: undefined reference to `ImmGetIMEFileNameA#12'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:545: undefined reference to `GetFileVersionInfoSizeA#8'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:549: undefined reference to `GetFileVersionInfoA#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:550: undefined reference to `VerQueryValueA#16'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_ClearComposition':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:662: undefined reference to `ImmGetContext#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:666: undefined reference to `ImmNotifyIME#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:670: undefined reference to `ImmNotifyIME#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:671: undefined reference to `ImmReleaseContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Disable':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:344: undefined reference to `ImmAssociateContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_ClearComposition':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:668: undefined reference to `ImmSetCompositionStringW#24'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:662: undefined reference to `ImmGetContext#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:666: undefined reference to `ImmNotifyIME#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:670: undefined reference to `ImmNotifyIME#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:671: undefined reference to `ImmReleaseContext#8'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:668: undefined reference to `ImmSetCompositionStringW#24'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Init':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:303: undefined reference to `ImmGetContext#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:304: undefined reference to `ImmReleaseContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetId':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:530: undefined reference to `ImmGetIMEFileNameA#12'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:545: undefined reference to `GetFileVersionInfoSizeA#8'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:549: undefined reference to `GetFileVersionInfoA#16'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetReadingString':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:402: undefined reference to `ImmGetContext#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:477: undefined reference to `ImmReleaseContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetId':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:550: undefined reference to `VerQueryValueA#16'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Quit':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:358: undefined reference to `ImmAssociateContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Enable':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:329: undefined reference to `ImmAssociateContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_ClearComposition':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:662: undefined reference to `ImmGetContext#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:666: undefined reference to `ImmNotifyIME#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:670: undefined reference to `ImmNotifyIME#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:671: undefined reference to `ImmReleaseContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_Disable':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:344: undefined reference to `ImmAssociateContext#8'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:668: undefined reference to `ImmSetCompositionStringW#24'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_HandleMessage':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:834: undefined reference to `ImmGetContext#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetCompositionString':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:678: undefined reference to `ImmGetCompositionStringW#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:683: undefined reference to `ImmGetCompositionStringW#16'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_HandleMessage':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:872: undefined reference to `ImmReleaseContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_ClearComposition':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:662: undefined reference to `ImmGetContext#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:666: undefined reference to `ImmNotifyIME#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:670: undefined reference to `ImmNotifyIME#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:671: undefined reference to `ImmReleaseContext#8'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_HandleMessage':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:867: undefined reference to `ImmGetContext#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetCandidateList':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:746: undefined reference to `ImmGetCandidateListW#16'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetCompositionString':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:678: undefined reference to `ImmGetCompositionStringW#16'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:683: undefined reference to `ImmGetCompositionStringW#16'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_InputLangChanged':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:668: undefined reference to `ImmSetCompositionStringW#24'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_windowskeyboard.o): In function `IME_GetCandidateList':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:750: undefined reference to `ImmGetCandidateListW#16'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_winmm.o): In function `WINMM_CloseDevice':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:172: undefined reference to `_imp__waveOutUnprepareHeader#12'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:172: undefined reference to `_imp__waveOutUnprepareHeader#12'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:184: undefined reference to `_imp__waveInClose#4'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:189: undefined reference to `_imp__waveOutClose#4'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_winmm.o): In function `WINMM_PlayDevice':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:133: undefined reference to `_imp__waveOutWrite#12'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_winmm.o): In function `DetectWaveOutDevs':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:55: undefined reference to `_imp__waveOutGetNumDevs#0'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:55: undefined reference to `_imp__waveOutGetDevCapsW#12'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_winmm.o): In function `DetectWaveInDevs':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:56: undefined reference to `_imp__waveInGetNumDevs#0'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:56: undefined reference to `_imp__waveInGetDevCapsW#12'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_winmm.o): In function `WINMM_OpenDevice':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:235: undefined reference to `_imp__waveInGetNumDevs#0'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:238: undefined reference to `_imp__waveInGetDevCapsW#12'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:316: undefined reference to `_imp__waveInOpen#24'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:366: undefined reference to `_imp__waveOutPrepareHeader#12'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:248: undefined reference to `_imp__waveOutGetNumDevs#0'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:251: undefined reference to `_imp__waveOutGetDevCapsW#12'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_winmm.o): In function `PrepWaveFormat':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:218: undefined reference to `_imp__waveOutOpen#24'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:216: undefined reference to `_imp__waveInOpen#24'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_winmm.o): In function `WINMM_OpenDevice':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:320: undefined reference to `_imp__waveOutOpen#24'
c:/SDL2-2.0.3/i686-w64-mingw32/lib\libSDL2.a(SDL_winmm.o): In function `SetMMerror':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:108: undefined reference to `_imp__waveOutGetErrorTextW#12'
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/audio/winmm/SDL_winmm.c:108: undefined reference to `_imp__waveOutGetErrorTextW#12'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [racer-sdl.exe] Error 1
make[1]: *** [CMakeFiles/racer-sdl.dir/all] Error 2
make: *** [all] Error 2
The answer is given here: SDL 1.3/2.0 setting up
One has to link against these libraries:
-lmingw32 -lSDL2main -lSDL2 -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid
I am using tesseract-ocr and leptonica library in my small project.
My "CMakeLists.txt" file looks like following: (I have necessary header files in 'include' folder)
cmake_minimum_required(VERSION 2.8.7)
project(OCR)
include_directories(include)
find_library(LEPT liblept)
find_library(TESS libtesseract)
set(LIBS ${LEPT} ${TESS})
add_executable(getText ocr.cpp)
target_link_libraries(getText ${LIBS})
But when I run this and then run make, my program does not get compiled
However, when I do this, it gets perfectly compiled
$ g++ ocr.cpp -o getText -I/usr/include/leptonica
-I/usr/local/include/tesseract -llept -ltesseract
But I need to make first approach succesful. Please help.
I have
#include "basapi.h"
#include "allheaders.h"
,by the way, in my code.
This is fine:
$ cmake .
/usr/local/lib/liblept.a/usr/local/lib/libtesseract.a
-- Configuring done
-- Generating done
-- Build files have been written to: /home/utkrist/OCR
But this is not (gives some leptonica and tesseract-ocr related errors)
$ make
Linking CXX executable getText
/usr/local/lib/libtesseract.a(imagefind.o): In function `tesseract::ImageFind::FindImages(Pix*)':
/home/utkrist/Downloads/tesseract-ocr/textord/imagefind.cpp:78: undefined reference to `pixGenHalftoneMask'
/usr/local/lib/libtesseract.a(tabfind.o): In function `tesseract::TabFind::Deskew(tesseract::TabVector_LIST*, BLOBNBOX_LIST*, TO_BLOCK*, FCOORD*, FCOORD*)':
/home/utkrist/Downloads/tesseract-ocr/textord/tabfind.cpp:1286: undefined reference to `pixRotate'
/usr/local/lib/libtesseract.a(svutil.o): In function `SVSemaphore':
/home/utkrist/Downloads/tesseract-ocr/viewer/svutil.cpp:129: undefined reference to `sem_init'
/usr/local/lib/libtesseract.a(svutil.o): In function `SVSemaphore::Signal()':
/home/utkrist/Downloads/tesseract-ocr/viewer/svutil.cpp:137: undefined reference to `sem_post'
/usr/local/lib/libtesseract.a(svutil.o): In function `SVSemaphore::Wait()':
/home/utkrist/Downloads/tesseract-ocr/viewer/svutil.cpp:145: undefined reference to `sem_wait'
/usr/local/lib/libtesseract.a(svutil.o): In function `SVSync::StartThread(void* (*)(void*), void*)':
/home/utkrist/Downloads/tesseract-ocr/viewer/svutil.cpp:188: undefined reference to `pthread_create'
/usr/local/lib/liblept.a(tiffio.o): In function `pixWriteToTiffStream':
/home/utkrist/leptonica-1.69/src/tiffio.c:646: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:647: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:648: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:650: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:651: undefined reference to `TIFFSetField'
/usr/local/lib/liblept.a(tiffio.o):/home/utkrist/leptonica-1.69/src/tiffio.c:652: more undefined references to `TIFFSetField' follow
/usr/local/lib/liblept.a(tiffio.o): In function `pixWriteToTiffStream':
/home/utkrist/leptonica-1.69/src/tiffio.c:723: undefined reference to `TIFFScanlineSize'
/home/utkrist/leptonica-1.69/src/tiffio.c:732: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:742: undefined reference to `TIFFWriteScanline'
/home/utkrist/leptonica-1.69/src/tiffio.c:688: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:689: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:690: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:691: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:695: undefined reference to `TIFFSetField'
/usr/local/lib/liblept.a(tiffio.o):/home/utkrist/leptonica-1.69/src/tiffio.c:696: more undefined references to `TIFFSetField' follow
/usr/local/lib/liblept.a(tiffio.o): In function `pixWriteToTiffStream':
/home/utkrist/leptonica-1.69/src/tiffio.c:763: undefined reference to `TIFFWriteScanline'
/usr/local/lib/liblept.a(tiffio.o): In function `writeCustomTiffTags':
/home/utkrist/leptonica-1.69/src/tiffio.c:838: undefined reference to `TIFFSetField'
/usr/local/lib/liblept.a(tiffio.o): In function `pixWriteToTiffStream':
/home/utkrist/leptonica-1.69/src/tiffio.c:658: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:750: undefined reference to `TIFFWriteScanline'
/home/utkrist/leptonica-1.69/src/tiffio.c:703: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:713: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:705: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:707: undefined reference to `TIFFSetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:709: undefined reference to `TIFFSetField'
/usr/local/lib/liblept.a(tiffio.o):/home/utkrist/leptonica-1.69/src/tiffio.c:666: more undefined references to `TIFFSetField' follow
/usr/local/lib/liblept.a(tiffio.o): In function `getTiffStreamResolution':
/home/utkrist/leptonica-1.69/src/tiffio.c:1188: undefined reference to `TIFFGetFieldDefaulted'
/home/utkrist/leptonica-1.69/src/tiffio.c:1189: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1190: undefined reference to `TIFFGetField'
/usr/local/lib/liblept.a(tiffio.o): In function `tiffReadHeaderTiff':
/home/utkrist/leptonica-1.69/src/tiffio.c:1429: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1431: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1433: undefined reference to `TIFFGetFieldDefaulted'
/home/utkrist/leptonica-1.69/src/tiffio.c:1435: undefined reference to `TIFFGetFieldDefaulted'
/home/utkrist/leptonica-1.69/src/tiffio.c:1446: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1451: undefined reference to `TIFFGetFieldDefaulted'
/usr/local/lib/liblept.a(tiffio.o): In function `pixReadFromTiffStream':
/home/utkrist/leptonica-1.69/src/tiffio.c:287: undefined reference to `TIFFGetFieldDefaulted'
/home/utkrist/leptonica-1.69/src/tiffio.c:288: undefined reference to `TIFFGetFieldDefaulted'
/home/utkrist/leptonica-1.69/src/tiffio.c:299: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:300: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:301: undefined reference to `TIFFScanlineSize'
/home/utkrist/leptonica-1.69/src/tiffio.c:334: undefined reference to `TIFFReadRGBAImageOriented'
/home/utkrist/leptonica-1.69/src/tiffio.c:362: undefined reference to `TIFFGetFieldDefaulted'
/home/utkrist/leptonica-1.69/src/tiffio.c:366: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:399: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:315: undefined reference to `TIFFReadScanline'
/home/utkrist/leptonica-1.69/src/tiffio.c:382: undefined reference to `TIFFGetField'
/usr/local/lib/liblept.a(tiffio.o): In function `openTiff':
/home/utkrist/leptonica-1.69/src/tiffio.c:1721: undefined reference to `TIFFOpen'
/usr/local/lib/liblept.a(tiffio.o): In function `fopenTiff':
/home/utkrist/leptonica-1.69/src/tiffio.c:1689: undefined reference to `TIFFFdOpen'
/usr/local/lib/liblept.a(tiffio.o): In function `fopenTiffMemstream':
/home/utkrist/leptonica-1.69/src/tiffio.c:1983: undefined reference to `TIFFClientOpen'
/usr/local/lib/liblept.a(tiffio.o): In function `pixReadStreamTiff':
/home/utkrist/leptonica-1.69/src/tiffio.c:231: undefined reference to `TIFFReadDirectory'
/home/utkrist/leptonica-1.69/src/tiffio.c:237: undefined reference to `TIFFCleanup'
/home/utkrist/leptonica-1.69/src/tiffio.c:241: undefined reference to `TIFFCleanup'
/home/utkrist/leptonica-1.69/src/tiffio.c:226: undefined reference to `TIFFCleanup'
/usr/local/lib/liblept.a(tiffio.o): In function `pixWriteTiffCustom':
/home/utkrist/leptonica-1.69/src/tiffio.c:516: undefined reference to `TIFFClose'
/usr/local/lib/liblept.a(tiffio.o): In function `pixWriteStreamTiff':
/home/utkrist/leptonica-1.69/src/tiffio.c:576: undefined reference to `TIFFCleanup'
/home/utkrist/leptonica-1.69/src/tiffio.c:572: undefined reference to `TIFFCleanup'
/usr/local/lib/liblept.a(tiffio.o): In function `fprintTiffInfo':
/home/utkrist/leptonica-1.69/src/tiffio.c:1078: undefined reference to `TIFFPrintDirectory'
/home/utkrist/leptonica-1.69/src/tiffio.c:1079: undefined reference to `TIFFClose'
/usr/local/lib/liblept.a(tiffio.o): In function `tiffGetCount':
/home/utkrist/leptonica-1.69/src/tiffio.c:1114: undefined reference to `TIFFReadDirectory'
/home/utkrist/leptonica-1.69/src/tiffio.c:1118: undefined reference to `TIFFCleanup'
/usr/local/lib/liblept.a(tiffio.o): In function `getTiffResolution':
/home/utkrist/leptonica-1.69/src/tiffio.c:1155: undefined reference to `TIFFCleanup'
/usr/local/lib/liblept.a(tiffio.o): In function `freadHeaderTiff':
/home/utkrist/leptonica-1.69/src/tiffio.c:1320: undefined reference to `TIFFReadDirectory'
/home/utkrist/leptonica-1.69/src/tiffio.c:1326: undefined reference to `TIFFCleanup'
/usr/local/lib/liblept.a(tiffio.o): In function `readHeaderMemTiff':
/home/utkrist/leptonica-1.69/src/tiffio.c:1382: undefined reference to `TIFFReadDirectory'
/home/utkrist/leptonica-1.69/src/tiffio.c:1383: undefined reference to `TIFFClose'
/home/utkrist/leptonica-1.69/src/tiffio.c:1390: undefined reference to `TIFFClose'
/usr/local/lib/liblept.a(tiffio.o): In function `findTiffCompression':
/home/utkrist/leptonica-1.69/src/tiffio.c:1492: undefined reference to `TIFFGetFieldDefaulted'
/home/utkrist/leptonica-1.69/src/tiffio.c:1494: undefined reference to `TIFFCleanup'
/usr/local/lib/liblept.a(tiffio.o): In function `extractG4DataFromFile':
/home/utkrist/leptonica-1.69/src/tiffio.c:1599: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1602: undefined reference to `TIFFClose'
/home/utkrist/leptonica-1.69/src/tiffio.c:1606: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1607: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1608: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1611: undefined reference to `TIFFGetField'
/home/utkrist/leptonica-1.69/src/tiffio.c:1613: undefined reference to `TIFFClose'
/usr/local/lib/liblept.a(tiffio.o): In function `pixReadMemTiff':
/home/utkrist/leptonica-1.69/src/tiffio.c:2035: undefined reference to `TIFFReadDirectory'
/home/utkrist/leptonica-1.69/src/tiffio.c:2042: undefined reference to `TIFFClose'
/home/utkrist/leptonica-1.69/src/tiffio.c:2029: undefined reference to `TIFFClose'
/usr/local/lib/liblept.a(tiffio.o): In function `pixWriteMemTiffCustom':
/home/utkrist/leptonica-1.69/src/tiffio.c:2125: undefined reference to `TIFFClose'
/usr/local/lib/liblept.a(jpegio.o): In function `jpeg_error_do_not_exit':
/home/utkrist/leptonica-1.69/src/jpegio.c:1118: undefined reference to `jpeg_destroy'
/usr/local/lib/liblept.a(jpegio.o): In function `pixReadStreamJpeg':
/home/utkrist/leptonica-1.69/src/jpegio.c:259: undefined reference to `jpeg_std_error'
/home/utkrist/leptonica-1.69/src/jpegio.c:262: undefined reference to `jpeg_CreateDecompress'
/home/utkrist/leptonica-1.69/src/jpegio.c:265: undefined reference to `jpeg_set_marker_processor'
/home/utkrist/leptonica-1.69/src/jpegio.c:266: undefined reference to `jpeg_stdio_src'
/home/utkrist/leptonica-1.69/src/jpegio.c:267: undefined reference to `jpeg_read_header'
/home/utkrist/leptonica-1.69/src/jpegio.c:272: undefined reference to `jpeg_calc_output_dimensions'
/home/utkrist/leptonica-1.69/src/jpegio.c:310: undefined reference to `jpeg_start_decompress'
/home/utkrist/leptonica-1.69/src/jpegio.c:374: undefined reference to `jpeg_read_scanlines'
/home/utkrist/leptonica-1.69/src/jpegio.c:399: undefined reference to `jpeg_finish_decompress'
/home/utkrist/leptonica-1.69/src/jpegio.c:400: undefined reference to `jpeg_destroy_decompress'
/home/utkrist/leptonica-1.69/src/jpegio.c:336: undefined reference to `jpeg_read_scanlines'
/home/utkrist/leptonica-1.69/src/jpegio.c:315: undefined reference to `jpeg_start_decompress'
/usr/local/lib/liblept.a(jpegio.o): In function `freadHeaderJpeg':
/home/utkrist/leptonica-1.69/src/jpegio.c:491: undefined reference to `jpeg_std_error'
/home/utkrist/leptonica-1.69/src/jpegio.c:493: undefined reference to `jpeg_CreateDecompress'
/home/utkrist/leptonica-1.69/src/jpegio.c:494: undefined reference to `jpeg_stdio_src'
/home/utkrist/leptonica-1.69/src/jpegio.c:495: undefined reference to `jpeg_read_header'
/home/utkrist/leptonica-1.69/src/jpegio.c:496: undefined reference to `jpeg_calc_output_dimensions'
/home/utkrist/leptonica-1.69/src/jpegio.c:507: undefined reference to `jpeg_destroy_decompress'
/usr/local/lib/liblept.a(jpegio.o): In function `fgetJpegResolution':
/home/utkrist/leptonica-1.69/src/jpegio.c:545: undefined reference to `jpeg_std_error'
/home/utkrist/leptonica-1.69/src/jpegio.c:547: undefined reference to `jpeg_CreateDecompress'
/home/utkrist/leptonica-1.69/src/jpegio.c:548: undefined reference to `jpeg_stdio_src'
/home/utkrist/leptonica-1.69/src/jpegio.c:549: undefined reference to `jpeg_read_header'
/home/utkrist/leptonica-1.69/src/jpegio.c:562: undefined reference to `jpeg_destroy_decompress'
/usr/local/lib/liblept.a(jpegio.o): In function `pixWriteStreamJpeg':
/home/utkrist/leptonica-1.69/src/jpegio.c:699: undefined reference to `jpeg_std_error'
/home/utkrist/leptonica-1.69/src/jpegio.c:702: undefined reference to `jpeg_CreateCompress'
/home/utkrist/leptonica-1.69/src/jpegio.c:703: undefined reference to `jpeg_stdio_dest'
/home/utkrist/leptonica-1.69/src/jpegio.c:717: undefined reference to `jpeg_set_defaults'
/home/utkrist/leptonica-1.69/src/jpegio.c:732: undefined reference to `jpeg_set_quality'
/home/utkrist/leptonica-1.69/src/jpegio.c:754: undefined reference to `jpeg_start_compress'
/home/utkrist/leptonica-1.69/src/jpegio.c:757: undefined reference to `jpeg_write_marker'
/home/utkrist/leptonica-1.69/src/jpegio.c:797: undefined reference to `jpeg_write_scanlines'
/home/utkrist/leptonica-1.69/src/jpegio.c:800: undefined reference to `jpeg_finish_compress'
/home/utkrist/leptonica-1.69/src/jpegio.c:809: undefined reference to `jpeg_destroy_compress'
/home/utkrist/leptonica-1.69/src/jpegio.c:784: undefined reference to `jpeg_write_scanlines'
/home/utkrist/leptonica-1.69/src/jpegio.c:734: undefined reference to `jpeg_simple_progression'
/home/utkrist/leptonica-1.69/src/jpegio.c:699: undefined reference to `jpeg_std_error'
/home/utkrist/leptonica-1.69/src/jpegio.c:702: undefined reference to `jpeg_CreateCompress'
/home/utkrist/leptonica-1.69/src/jpegio.c:703: undefined reference to `jpeg_stdio_dest'
/usr/local/lib/liblept.a(pngio.o): In function `pixReadStreamPng':
/home/utkrist/leptonica-1.69/src/pngio.c:182: undefined reference to `png_create_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:186: undefined reference to `png_create_info_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:191: undefined reference to `png_create_info_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:202: undefined reference to `png_init_io'
/home/utkrist/leptonica-1.69/src/pngio.c:218: undefined reference to `png_read_png'
/home/utkrist/leptonica-1.69/src/pngio.c:220: undefined reference to `png_get_rows'
/home/utkrist/leptonica-1.69/src/pngio.c:221: undefined reference to `png_get_image_width'
/home/utkrist/leptonica-1.69/src/pngio.c:222: undefined reference to `png_get_image_height'
/home/utkrist/leptonica-1.69/src/pngio.c:223: undefined reference to `png_get_bit_depth'
/home/utkrist/leptonica-1.69/src/pngio.c:224: undefined reference to `png_get_rowbytes'
/home/utkrist/leptonica-1.69/src/pngio.c:225: undefined reference to `png_get_color_type'
/home/utkrist/leptonica-1.69/src/pngio.c:226: undefined reference to `png_get_channels'
/home/utkrist/leptonica-1.69/src/pngio.c:336: undefined reference to `png_get_x_pixels_per_meter'
/home/utkrist/leptonica-1.69/src/pngio.c:337: undefined reference to `png_get_y_pixels_per_meter'
/home/utkrist/leptonica-1.69/src/pngio.c:342: undefined reference to `png_get_text'
/home/utkrist/leptonica-1.69/src/pngio.c:346: undefined reference to `png_destroy_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:198: undefined reference to `png_destroy_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:241: undefined reference to `png_destroy_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:248: undefined reference to `png_get_PLTE'
/home/utkrist/leptonica-1.69/src/pngio.c:187: undefined reference to `png_destroy_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:192: undefined reference to `png_destroy_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:261: undefined reference to `png_destroy_read_struct'
/usr/local/lib/liblept.a(pngio.o): In function `fgetPngResolution':
/home/utkrist/leptonica-1.69/src/pngio.c:534: undefined reference to `png_create_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:537: undefined reference to `png_create_info_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:551: undefined reference to `png_init_io'
/home/utkrist/leptonica-1.69/src/pngio.c:552: undefined reference to `png_read_png'
/home/utkrist/leptonica-1.69/src/pngio.c:554: undefined reference to `png_get_x_pixels_per_meter'
/home/utkrist/leptonica-1.69/src/pngio.c:555: undefined reference to `png_get_y_pixels_per_meter'
/home/utkrist/leptonica-1.69/src/pngio.c:559: undefined reference to `png_destroy_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:545: undefined reference to `png_destroy_read_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:538: undefined reference to `png_destroy_read_struct'
/usr/local/lib/liblept.a(pngio.o): In function `pixWriteStreamPng':
/home/utkrist/leptonica-1.69/src/pngio.c:701: undefined reference to `png_create_write_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:705: undefined reference to `png_create_info_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:716: undefined reference to `png_init_io'
/home/utkrist/leptonica-1.69/src/pngio.c:721: undefined reference to `png_set_compression_level'
/home/utkrist/leptonica-1.69/src/pngio.c:754: undefined reference to `png_set_IHDR'
/home/utkrist/leptonica-1.69/src/pngio.c:764: undefined reference to `png_set_pHYs'
/home/utkrist/leptonica-1.69/src/pngio.c:804: undefined reference to `png_set_text'
/home/utkrist/leptonica-1.69/src/pngio.c:808: undefined reference to `png_write_info'
/home/utkrist/leptonica-1.69/src/pngio.c:840: undefined reference to `png_set_rows'
/home/utkrist/leptonica-1.69/src/pngio.c:843: undefined reference to `png_write_image'
/home/utkrist/leptonica-1.69/src/pngio.c:844: undefined reference to `png_write_end'
/home/utkrist/leptonica-1.69/src/pngio.c:886: undefined reference to `png_destroy_write_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:712: undefined reference to `png_destroy_write_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:781: undefined reference to `png_set_PLTE'
/home/utkrist/leptonica-1.69/src/pngio.c:791: undefined reference to `png_set_gAMA'
/home/utkrist/leptonica-1.69/src/pngio.c:860: undefined reference to `png_write_rows'
/home/utkrist/leptonica-1.69/src/pngio.c:882: undefined reference to `png_write_end'
/home/utkrist/leptonica-1.69/src/pngio.c:706: undefined reference to `png_destroy_write_struct'
/home/utkrist/leptonica-1.69/src/pngio.c:877: undefined reference to `png_write_rows'
/home/utkrist/leptonica-1.69/src/pngio.c:829: undefined reference to `png_destroy_write_struct'
/usr/local/lib/liblept.a(zlibmem.o): In function `zlibCompress':
/home/utkrist/leptonica-1.69/src/zlibmem.c:121: undefined reference to `deflateInit_'
/home/utkrist/leptonica-1.69/src/zlibmem.c:132: undefined reference to `deflate'
/home/utkrist/leptonica-1.69/src/zlibmem.c:144: undefined reference to `deflateEnd'
/usr/local/lib/liblept.a(zlibmem.o): In function `zlibUncompress':
/home/utkrist/leptonica-1.69/src/zlibmem.c:201: undefined reference to `inflateInit_'
/home/utkrist/leptonica-1.69/src/zlibmem.c:212: undefined reference to `inflate'
/home/utkrist/leptonica-1.69/src/zlibmem.c:224: undefined reference to `inflateEnd'
collect2: ld returned 1 exit status
make[2]: *** [getText] Error 1
make[1]: *** [CMakeFiles/getText.dir/all] Error 2
make: *** [all] Error 2
I've faced such problems several times, and what I do is to instruct CMake to generate a UNIX Makefile, and then look at what g++ command the Makefile is executing.
I know its not a great answer, but maybe It'll help.
These days, I've been messing around with the Objective-C runtime, trying to find out how some things work. In one of my "experiments", I did the following: I got the following code which is in a file called test.m:
#import <objc/Object.h>
#interface MySuperClass: Object {
}
-(int) myMessage1;
#end
#interface MyClass: MySuperClass {
int myIvar;
}
-(void) myMessage2;
#end
#implementation MyClass
-(void) myMessage2 {
myIvar++;
}
#end
int main() {
MyClass *myObject;
myObject = [[MyClass alloc] init];
[myObject myMessage2];
return 0;
}
and tried to compile it with clang -fobjc-nonfragile-abi -fnext-runtime -o test test.m. As you can imagine, the compiler will generate a linking error message because I'm compiling an Objective-C file, but I'm not telling the linker to link it against an Objective-C runtime library (with the -lobjc option, for example). But I did that on purpose, to check out which objc runtime library symbols would be referenced and, thus, would be missing. And I got the following error message:
$ clang -fobjc-nonfragile-abi -fnext-runtime -o test test.m
/tmp/test-jEfgSA.o:(__DATA, __objc_data+0x0): undefined reference to `OBJC_METACLASS_$_Object'
/tmp/test-jEfgSA.o:(__DATA, __objc_data+0x8): undefined reference to `OBJC_METACLASS_$_MySuperClass'
/tmp/test-jEfgSA.o:(__DATA, __objc_data+0x10): undefined reference to `_objc_empty_cache'
/tmp/test-jEfgSA.o:(__DATA, __objc_data+0x18): undefined reference to `_objc_empty_vtable'
/tmp/test-jEfgSA.o:(__DATA, __objc_data+0x30): undefined reference to `OBJC_CLASS_$_MySuperClass'
/tmp/test-jEfgSA.o:(__DATA, __objc_data+0x38): undefined reference to `_objc_empty_cache'
/tmp/test-jEfgSA.o:(__DATA, __objc_data+0x40): undefined reference to `_objc_empty_vtable'
/tmp/test-jEfgSA.o:(__DATA, __objc_msgrefs, coalesced+0x0): undefined reference to `objc_msgSend_fixup'
/tmp/test-jEfgSA.o:(__DATA, __objc_msgrefs, coalesced+0x10): undefined reference to `objc_msgSend_fixup'
/tmp/test-jEfgSA.o:(__DATA, __objc_msgrefs, coalesced+0x20): undefined reference to `objc_msgSend_fixup'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It's easy to understand why some of the listed symbols are undefined. objc_msgSend_fixup, for example, refers to a runtime library function. _objc_empty_cache and _objc_empty_vtable are both runtime library structs declared in http://opensource.apple.com/source/objc4/objc4-532/runtime/objc-abi.h. However, OBJC_METACLASS_$_MySuperClass and OBJC_CLASS_$_MySuperClass are structs that represent a class that has been declared in test.m, so that there is no reference in the Objective-C runtime library to these symbols. They should be defined in teste.o, but it seems they're not. So, why does this happen?
And one more thing: there is no broken reference to neither OBJC_METACLASS_$_MyClass nor OBJC_CLASS_$_MyClass. Therefore, there are broken references to Object and MySuperClass and both of them have subclasses in test.m, but there is no broken reference to MyClass, which has no subclass. So, why the linker seems to expect there to be references, in the runtime library, to the classes that have subclasses, but not to those that haven't any?
Good to experiment with these sorts of things. It will be helpful later when you get similar errors and need to debug.
A few points that stick out:
This isn't really about subclassing. You could get similar errors just by trying to instantiate an Object, for example.
The linker tries (in simplified terms) to match compiled code, and its associated symbol table, up with references in the code.
You don't have an implementation of MySuperClass, so no object code is generated, and no symbols exists that match your interface definition of MySuperClass. You can make this error go away by implementing MySuperClass.
MyClass is fine, because you have implemented MyClass in the file, so the linker can find a valid symbol to link to.
I found out that the OBJC_METACLASS_$_<my class name> symbols are defined in the object file only if there is an #implementation <my class name> statement. So, if I add, for example, the snippet:
#implementation MySuperClass
-(int) myMessage1 {
return 0;
}
#end
to test.m, the linker would generate the error message:
$ clang -fobjc-nonfragile-abi -fnext-runtime -o class_teste class_teste.m
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x0): undefined reference to `OBJC_METACLASS_$_Object'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x8): undefined reference to `OBJC_METACLASS_$_Object'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x10): undefined reference to `_objc_empty_cache'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x18): undefined reference to `_objc_empty_vtable'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x30): undefined reference to `OBJC_CLASS_$_Object'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x38): undefined reference to `_objc_empty_cache'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x40): undefined reference to `_objc_empty_vtable'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x50): undefined reference to `OBJC_METACLASS_$_Object'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x60): undefined reference to `_objc_empty_cache'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x68): undefined reference to `_objc_empty_vtable'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x88): undefined reference to `_objc_empty_cache'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_data+0x90): undefined reference to `_objc_empty_vtable'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_msgrefs, coalesced+0x0): undefined reference to `objc_msgSend_fixup'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_msgrefs, coalesced+0x10): undefined reference to `objc_msgSend_fixup'
/tmp/class_teste-gDWfF6.o:(__DATA, __objc_msgrefs, coalesced+0x20): undefined reference to `objc_msgSend_fixup'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
which is pretty acceptable, since all these undefined symbols are part of the Objective-C runtime library. Since my first version of test.m was for testing purpose, I hadn't added an implementation to the MySuperClass class as I thought it wouldn't affect the object file's symbols table. So, the problem has nothing to do with subclassing.