2017-04-21 23 views
1

에서 참조 _png_init_io, 내가 dowloaded 및 leptonica.zip의 압축을 푼 다음 단계를 따라했습니다 : 그 후되지 않은 외부 기호가 윈도우 7에서 기능 _pixReadStreamPng

cd leptonica 
mkdir build 
cd build 
set PATH=%PATH%;C:\OCR\additionalLibs\zlib-1.2.8\build\Debug;C:\OCR\additionalLibs\zlib-1.2.8\build;C:\OCR\additionalLibs\zlib-1.2.8 
set PATH=%PATH%;C:\OCR\additionalLibs\lpng143;C:\OCR\additionalLibs\lpng143\build\Debug;C:\OCR\additionalLibs\lpng143\build 
cmake .. 

를, 내가 얻을 :

-- Building for: Visual Studio 14 2015 
-- The C compiler identification is MSVC 19.0.24213.1 
-- The CXX compiler identification is MSVC 19.0.24213.1 
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 
14.0/VC/bin/cl.exe 
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 
14.0/VC/bin/cl.exe -- works 
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done 
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studi 
o 14.0/VC/bin/cl.exe 
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studi 
o 14.0/VC/bin/cl.exe -- works 
-- Detecting CXX compiler ABI info 
-- Detecting CXX compiler ABI info - done 
-- Detecting CXX compile features 
-- Detecting CXX compile features - done 
-- Could NOT find GIF (missing: GIF_LIBRARY GIF_INCLUDE_DIR) 
-- Could NOT find JPEG (missing: JPEG_LIBRARY) 
-- Found ZLIB: C:/OCR/additionalLibs/zlib-1.2.8/build/Debug/zlibd.lib (found ver 
sion "1.2.8") 
-- Found PNG: C:/OCR/additionalLibs/lpng143/build/Debug/png14d.lib (found versio 
n "1.4.3") 
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR) 
-- Found PkgConfig: C:/Program Files/CMake/bin/pkg-config.exe (found version "0. 
26") 
-- Checking for module 'libwebp' 
-- No package 'libwebp' found 
-- Checking for module 'libopenjp2' 
-- No package 'libopenjp2' found 
-- Looking for include file dlfcn.h 
-- Looking for include file dlfcn.h - not found 
-- Looking for include file inttypes.h 
-- Looking for include file inttypes.h - found 
-- Looking for include file memory.h 
-- Looking for include file memory.h - found 
-- Looking for include file stdint.h 
-- Looking for include file stdint.h - found 
-- Looking for include file stdlib.h 
-- Looking for include file stdlib.h - found 
-- Looking for include file strings.h 
-- Looking for include file strings.h - not found 
-- Looking for include file string.h 
-- Looking for include file string.h - found 
-- Looking for include file sys/stat.h 
-- Looking for include file sys/stat.h - found 
-- Looking for include file sys/types.h 
-- Looking for include file sys/types.h - found 
-- Looking for include file unistd.h 
-- Looking for include file unistd.h - not found 
-- Looking for include file openjpeg-2.0/openjpeg.h 
-- Looking for include file openjpeg-2.0/openjpeg.h - not found 
-- Looking for include file openjpeg-2.1/openjpeg.h 
-- Looking for include file openjpeg-2.1/openjpeg.h - not found 
-- Looking for include file openjpeg-2.2/openjpeg.h 
-- Looking for include file openjpeg-2.2/openjpeg.h - not found 
-- Looking for fmemopen 
-- Looking for fmemopen - not found 
-- Check if the system is big endian 
-- Searching 16 bit integer 
-- Looking for stddef.h 
-- Looking for stddef.h - found 
-- Check size of unsigned short 
-- Check size of unsigned short - done 
-- Using unsigned short 
-- Check if the system is big endian - little endian 
-- Configuring done 
-- Generating done 
-- Build files have been written to: C:/OCR/leptonica-master/build 

libjpeg, libtiff 및 libgif는 png 파일 관리에만 관심이 있으므로 의도적으로 고려하지 않았습니다. cmake 명령은 leptonica.sln 솔루션 파일을 출력합니다. 그런 다음 Visual Studio에서 솔루션 파일을 컴파일합니다 (헤더 파일을 찾으려면 zlib.h ; zconf.h; png.h; pngconfig.h C : \ OCR \ additionalLibs \ zlib-1.2.8, C : \ OCR \ additionalLibs \ lpng143을 추가하여 INCLUDE 디렉터리를 수정했습니다) .

하지만 솔루션으로 인해 오류로 컴파일되지 않습니다 :

LNK2019 unresolved external symbol _png_init_io referenced in function _pixReadStreamPng leptonica 
LNK2019 unresolved external symbol _png_init_io referenced in function _pixReadStreamPng leptonica 

오류는 pixReadStreamPngpng.h에 정의 된 기능 png_init_io를 호출 파일 pngio.h에서 온다. 함수의 구현을 찾을 수없는 것 같아요, 구현되어야하는 추가 라이브러리가 있습니까? png_init_io은 어디에 구현 되었습니까?

+1

이것은 png.c에서 구현됩니다. 하지만 #ifdef PNG_STDIO_SUPPORTED가 지키지 않았을 가능성이 있습니다. png.c의 의견보기 –

+0

@ GlennRanders-Pehrson 답장으로 작성하십시오. 문제가 해결되었습니다! =) 많이 감사합니다. – Robson

답변

1

libpng의 png.c에서 구현되었지만 정의되지 않은 가능성이있는 #ifdef PNG_STDIO_SUPPORTED에 의해 보호됩니다. png.c의 주석보기 :

# ifdef PNG_STDIO_SUPPORTED 
/* Initialize the default input/output functions for the PNG file. If you 
* use your own read or write routines, you can call either png_set_read_fn() 
* or png_set_write_fn() instead of png_init_io(). If you have defined 
* PNG_NO_STDIO or otherwise disabled PNG_STDIO_SUPPORTED, you must use a 
* function of your own because "FILE *" isn't necessarily available. 
*/ 
void PNGAPI 
png_init_io(png_structrp png_ptr, png_FILE_p fp) 
{ 
    png_debug(1, "in png_init_io"); 

    if (png_ptr == NULL) 
     return; 

    png_ptr->io_ptr = (png_voidp)fp; 
} 
# endif