VS2010下静态链接FreeImage

简介:

静态链接FreeImage的方法类似下面帖子:

http://h2appy.blog.51cto.com/609721/1408087


主要注意的是:

1. 下载FreeImage,用vs2010打开solution。编译FreeImageLib这个项目。

FreeImageLib项目中编译好的freeimaged.lib就是要使用的库文件。


2. 添加预编译参数:FREEIMAGE_LIB


3.调用时使用下面两个函数:

FreeImage_Initialise()

FreeImage_DeInitialise()


参考:

How to use FreeImage as a static library (Visual C++ 6) ?
Using FreeImage as a static library is not so easy, but it's not more complicated than using any other library. Here is a step by step method to do this :

  1. Compile the FreeImage library in debug and release modes and close your projects. You won't need to use the FreeImage source code anymore.
  2. Copy FreeImage.lib/FreeImaged.lib into your lib\ directory or in a directory where the compiler can find them (e.g. your project directory). You can use "Menu->Tools->Options->Directories->Library files" for this.
  3. Create a new project and add your code in it.
     Add a call to FreeImage_Initialise() at the beginning of you main function and a call to FreeImage_DeInitialise() at the end of this function.
  4. Edit the compiler options (Menu -> Project -> Settings)
        1. tab C/C++ : Category "Preprocessor"
               * Add FREEIMAGE_LIB to the preprocessor definitions 
        2. tab C/C++ : Category "Code Generation"
               * Use the Multithreaded run-time library (in release mode)
               * Use the Debug Multithreaded run-time library (in debug mode) 
  5. Edit linker options (Menu -> Project -> Settings)
        1. tab Link : Category Input
               * Add FreeImage.lib to the list of object/library modules (release mode)
               * Add FreeImaged.lib to the list of object/library modules (debug mode) 
        2. tab Link : Category Input
               * Add LIBCMT to the Ignore library list (it helps to avoid a warning) 
  6. Compile and link your program  










本文转自 h2appy  51CTO博客,原文链接:http://blog.51cto.com/h2appy/1408320,如需转载请自行联系原作者
目录
相关文章
|
5月前
|
小程序
在Masm32中如何静态链接自己编写的库文件
在Masm32中如何静态链接自己编写的库文件
|
开发者
静态链接与动态链接
空间链接使得不同的程序开发者和部门能够相对独立地开发和测试自己的程序模块,从某种意义上来将大大促进了程序开发的效率,原先限制程序的规模也随之扩大。但是慢慢地静态链接的诸多缺点也逐步暴露出来,比如浪费内存和磁盘空间、模块更新苦难你等问题,使得人们不得不寻找一种更好的方式来组织程序的模块。本文简单介绍静态链接与动态链接。
|
9月前
|
存储 程序员 编译器
静态链接详解
静态链接详解
|
存储 Cloud Native Linux
C++ 动态库与静态库的区别?
C++ 动态库与静态库的区别?
|
存储 Linux 编译器
什么是链接库 | 动态库与静态库
什么是链接库 | 动态库与静态库
239 0
|
存储 自然语言处理 程序员
编译程序的任务
编译程序是一种翻译程序,编译程序是将一种语言形式翻译成另一种语言形式。它将高级语言所写的源程序翻译成等价的机器语言或汇编语言的目标程序。 整个编译过程一般可以划分为 5 个阶段:词法分析、语法分析、语义分析及中间代码生成、中间代码优化和目标代码生成。
129 2
编译程序的任务
|
Linux API C语言
编译参数中如何包含头文件和动态链接库
GCC编译参数:如何包含头文件和动态链接库
81 0
|
Linux 编译器 Shell
【Linux系统编程】静态库和共享库
【Linux系统编程】静态库和共享库
169 0
|
vr&ar C语言 索引
静态链接和静态库
静态链接和静态库
199 0
|
开发者
动态链接和动态库
动态链接和动态库
142 0