简体   繁体   English

无法在QT Creator / MSVC中与libtiff链接

[英]Can't link with libtiff in QT Creator/MSVC

I am trying to write an application that saves 16 bit tiffs. 我正在尝试编写一个保存16位tiff的应用程序。 I use QT Creator and the QT API, but can't use the QT tiff features because of the 16 bit need. 我使用QT Creator和QT API,但由于需要16位,因此无法使用QT tiff功能。 My application needs to work in both Windows and Linux. 我的应用程序需要同时在Windows和Linux上运行。

The Linux version works fine. Linux版本工作正常。 When I try and link in Visual C++/Win 7, I get the following error messages: 当我尝试在Visual C ++ / Win 7中进行链接时,出现以下错误消息:

FrameSaveRunnable.obj : error LNK2019: unresolved external symbol __imp_TIFFClose referenced in function "protected: virtual void __cdecl FrameSaveRunnable::run(void)" (?run@FrameSaveRunnable@@MEAAXXZ)
FrameSaveRunnable.obj : error LNK2019: unresolved external symbol __imp_TIFFSetField referenced in function "protected: virtual void __cdecl FrameSaveRunnable::run(void)" (?run@FrameSaveRunnable@@MEAAXXZ)
FrameSaveRunnable.obj : error LNK2019: unresolved external symbol __imp_TIFFWriteScanline referenced in function "protected: virtual void __cdecl FrameSaveRunnable::run(void)" (?run@FrameSaveRunnable@@MEAAXXZ)
FrameSaveRunnable.obj : error LNK2019: unresolved external symbol __imp_TIFFOpen referenced in function "protected: virtual void __cdecl FrameSaveRunnable::run(void)" (?run@FrameSaveRunnable@@MEAAXXZ)
debug\avtcam.exe : fatal error LNK1120: 4 unresolved externals

The relevant parts of my .pro file look like this: 我的.pro文件的相关部分如下所示:

INCLUDEPATH += "C:\Program Files (x86)\GnuWin32\include"
LIBS += -L"C:\Program Files (x86)\GnuWin32\lib" -llibtiff

I have googled and searched all over, and it seems that the problem has to do with C/C++ name incompatabilities. 我到处搜索和搜索,看来问题出在C / C ++名称不兼容。 There are some suggestions as to how to fix it inside of Visual Studio, but I am working in the QT environment, and dont use VS at all--just the compiler. 关于如何在Visual Studio中修复它,有一些建议,但是我在QT环境中工作,根本不使用VS,只是使用编译器。 Is there an answer to this problem? 这个问题有答案吗?

My environment: QT 5.4.0, Visual Studio 12, win 7 Pro, libtiff binaries downloaded from http://gnuwin32.sourceforge.net/packages/tiff.htm 我的环境:QT 5.4.0,Visual Studio 12,win 7 Pro,libtiff二进制文件,可从http://gnuwin32.sourceforge.net/packages/tiff.htm下载

You need libtiff compiled for MSVC. 您需要为MSVC编译的libtiff。 MSVC is the significant part of your environment, not Qt. MSVC是您环境的重要部分,而不是Qt。

See http://www.remotesensing.org/libtiff/build.html#PC for instructions for building it (though I'm not sure if those are up to date), or there are other answers on stackoverflow on how to do it (eg Installing LibTiff to Visual Studio 2010 ). 有关构建它的说明,请参见http://www.remotesensing.org/libtiff/build.html#PC (尽管我不确定这些更新是否最新),或者在stackoverflow上还有其他答案(例如,将LibTiff安装到Visual Studio 2010中 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM