proj4的windows下编译

来源:互联网 发布:太阳线直销软件 编辑:程序博客网 时间:2024/05/14 01:49

 

         windows下编译proj 4.8.0的版本,走了不少弯路,做下笔记,以备忘。

          1  编译。

             总体上按压缩包中的readme,执行命令:

              打开vs2010的Visual Studio x64 Win64 命令提示(2010)窗口,执行脚本in\VCVARS32.BAT(这个很关键,否则会编译失败,找不到相应函数解析)

           C:\> cd proj
          C:\PROJ> nmake /f makefile.vc
           C:\PROJ> nmake /f makefile.vc install-all

          Note that you have to have the VC++ environment variables, and path
         setup properly.  This may involve running the VCVARS32.BAT script out
          of the Visual C++ tree. 

         

         执行此步骤后,会在C盘创建PROJ目录,包含:bin\lib\share\include四个文件夹,其中会有proj_api.h proj.lib proj_i.lib proj.dll等文件。

                  

        2   使用。

             编译后的proj4会生成proj.lib(静态链接)、 proj_i.lib(动态链接)、proj.dll等。

           a)  首先要引用头文件:           

                 extern "C" {
                  #include "proj_api.h"
              }

          b) 在link中添加proj_i.lib,因为我用的编译代码生成方式是MDd

          c) 把proj.dll放到程序的工作目录下。

          经过以上步骤,一般proj4就可以正常使用了。


0 0
原创粉丝点击