建筑&将FreeImage与Visual Studio Express 2013相链接 [英] Building & Linking FreeImage with Visual Studio Express 2013

查看:172
本文介绍了建筑&将FreeImage与Visual Studio Express 2013相链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多麻烦链接我的项目与FreeEmage库VSE 2013



我跟着这个答案VS2010无效:将FreeImage链接为VS2010中的静态库?



在调用FreeImage函数时,我得到LNK2019错误。



我已经链接了库,就像任何库一样。下面是我做的以下步骤:


li>

打开2008年解决方案(转换为2013年),并将所有项目的代码生成更改为/ MDd


  • 尝试构建项目,最小/最大值函数未定义所以我包括algorithm.h到那些文件,并停止那些错误。


  • 尝试构建项目,


  • 建立项目 - >成功(无法打开afxres.h)因此我使用windows.h交换了afxres.h。


  • 将新鲜的FreeImaged.lib复制到我的专案






    • 将FreeImage.dll复制到正在建立.exe的侦错资料夹


    • 将FreeImage.h新增至专案

      >
    • 在添加标题之前已添加#define FREEIMAGE_LIB


    • 尝试建立我的项目 - > LNK2019s无处不在。 >


    • 如果任何人已经能够在VS2013上构建FreeImage并且可以共享他们的方式,我将非常感谢它,有任何建议。

      解决方案

      您的烦恼的原因是,使用Visual Studio 2013一些突变(

      其中包括为了使用 std:

      :min()/ std :: max(),您现在必须包含标头 。这也涉及FreeImage。不幸的是,直到版本3.6.1(今天最近的版本),这个问题尚未解决。



      blog post 说明您需要做什么它编译。最相关的部分是:


      具体来说,您需要添加



      include< algorithm>



      到以下文件:




       源/ OpenEXR / IlmImf / ImfOutputFile.cpp 
      源/ OpenEXR / IlmImf / ImfScanLineInputFile.cpp
      源/ OpenEXR / IlmImf / ImfTiledMisc.cpp
      源/ OpenEXR / IlmImf / ImfTiledOutputFile.cpp
      源/ OpenEXR / Imath / ImathMatrixAlgo.cpp


      I'm having a lot of trouble linking my project with FreeImage library with VSE 2013

      I've followed this answer for VS2010 to no avail: Linking FreeImage as a static library in VS2010?

      I am getting LNK2019 errors when calling FreeImage functions.

      I've linked the library just as I would any library. Below are the following steps I made:

      1. Download FreeImage Source.

      2. Open the 2008 Solution (converted to 2013) and changed Code Generation to /MDd for all projects

      3. Attempted to build project but for some reason min/max functions were not defined So I included algorithm.h to those files and that stopped those errors.

      4. Attempted to build project and I get an error: "Could not open "afxres.h". So I swapped afxres.h with windows.h as suggested in another topic.

      5. Built the project -> success

      6. Copied Fresh FreeImaged.lib to to my project

        • Added directory to "Additional Library Directories"
        • Added FreeImaged.lib to Additional Dependencies under linker
      7. Copied FreeImaged.dll to my debug folder where the .exe is being built

      8. Added FreeImage.h to the project

      9. Added #define FREEIMAGE_LIB before including the header

      10. Attempted to build my project -> LNK2019s everywhere.

      If anyone has been able to build FreeImage on VS2013 and could share how they did it I would greatly appreciate it, or if anyone has any suggestions.

      解决方案

      The reason for your troubles is that with Visual Studio 2013 some breaking changes (as outlined by Microsoft) were introduced in related to C++11 conformity.

      One includes that in order to use std::min()/std::max(), you now have to include the header . This also concerns FreeImage. Unfortunately, up until version 3.6.1 (the most recent as of today) this hasn't been fixed yet.

      This blog post explains what you need to do to get it to compile. The most relevant part is:

      Specifically, you will need to add

      include <algorithm>

      to the following files:

      Source/OpenEXR/IlmImf/ImfOutputFile.cpp
      Source/OpenEXR/IlmImf/ImfScanLineInputFile.cpp
      Source/OpenEXR/IlmImf/ImfTiledMisc.cpp
      Source/OpenEXR/IlmImf/ImfTiledOutputFile.cpp
      Source/OpenEXR/Imath/ImathMatrixAlgo.cpp
      

      这篇关于建筑&amp;将FreeImage与Visual Studio Express 2013相链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆