2017-12-14 2 views
0

나는이 Qt는 프로젝트 구축을 얻기 위해 노력하고있어,하지만 난 ZLIB으로 할 필요 이러한 Undefined symbol 오류로 실행 해요 :QL 프로젝트에 zLib을 포함시키는 올바른 방법은 무엇입니까?

Undefined symbols for architecture x86_64: 
    "_z_crc32", referenced from: 
     ZipPrivate::createEntry(QFileInfo const&, QString const&, Zip::CompressionLevel) in zip.o 
     UnzipPrivate::extractFile(QString const&, ZipEntryP const&, QIODevice*, QFlags<UnZip::ExtractionOption>) in unzip.o 
    "_z_deflate", referenced from: 
     ZipPrivate::createEntry(QFileInfo const&, QString const&, Zip::CompressionLevel) in zip.o 
    "_z_deflateEnd", referenced from: 
     ZipPrivate::createEntry(QFileInfo const&, QString const&, Zip::CompressionLevel) in zip.o 
    "_z_deflateInit2_", referenced from: 
     ZipPrivate::createEntry(QFileInfo const&, QString const&, Zip::CompressionLevel) in zip.o 
    "_z_get_crc_table", referenced from: 
     ZipPrivate::ZipPrivate() in zip.o 
     UnzipPrivate::UnzipPrivate() in unzip.o 
    "_z_inflate", referenced from: 
     UnzipPrivate::extractFile(QString const&, ZipEntryP const&, QIODevice*, QFlags<UnZip::ExtractionOption>) in unzip.o 
    "_z_inflateEnd", referenced from: 
     UnzipPrivate::extractFile(QString const&, ZipEntryP const&, QIODevice*, QFlags<UnZip::ExtractionOption>) in unzip.o 
    "_z_inflateInit2_", referenced from: 
     UnzipPrivate::extractFile(QString const&, ZipEntryP const&, QIODevice*, QFlags<UnZip::ExtractionOption>) in unzip.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

을 내 프로젝트에서 zlib 폴더를하고 난 (zlib/zconf.h을 포함하고있어 zlib 디렉토리는 /usr/local/opt/zlib/include에 대한 심볼릭 링크이며 zlib/zlib.h입니다. 여기

LIBS += -L/usr/local/opt/zlib/lib 
INCLUDEPATH += /usr/local/opt/zlib/include 
HEADERS += /usr/local/opt/zlib/include/zconf.h 
HEADERS += /usr/local/opt/zlib/include/zlib.h 

그리고 내가 ZLIB를 가져 오는거야 방법은 다음과 같습니다 : 내 .PRO 파일에 다음 줄을 포함하고있어

#include <zlib/zconf.h> 
#include <zlib/zlib.h> 

내가 Qt를, C에 아주 새로운 해요 ++ 및 ZLIB. Qt/C++ 프로젝트에서 zlib을 포함하는 올바른 방법은 무엇입니까?

+0

zlib을 어떻게 설치 했습니까? – eyllanesc

+0

LIBS에'-lzlib'을 추가해야합니다 –

+1

'LIBS + = -L/usr/local/opt/zlib/lib -lz'로 변경하십시오. – eyllanesc

답변

0

다음 해결책을 시도하십시오.

  1. zlib in Qt - QtZlib not present

  2. 당신은 ZipPrivate :: createEntry 및 UnzipPrivate :: extractFile을 정의하고 포함 텍스트 검색하여 찾을 수 있습니다

    그 INCLUDEPATH 또는 헤더에 파일을 저장합니다.

  3. 오류는 CONFIG 변수에 대해 손실 된 옵션처럼 보입니다. 프로젝트의 zlib 지원을 켤 수있는 발견 된 옵션. 나는 그 순간에 그 옵션을 모른다.

관련 문제