How to build OpenCV 2.3.1 under VS2010

  1. 下载CMake最新版本和OpenCV2.3.1,安装。
  2. 运行cmake-gui,设置“Where is the source code”,直接输入OpenCV2.3.1的安装目录,比如“F:\opencv”;设置“Where is build the binaries”, 这个位置随便,可以自己新建个文件夹就放在安装目录下,比如“F:\opencv\vs2010”;
  3. 点击“Configure”,在弹出的对话框中选中Visual Studio 10.0,注意操作系统的32位和64位差别,其他选择默认的,然后点击“Finish”,程序会自动完成“Configure Done”。
  4. 然后点击“Configure”,接着点击“Generate”,程序完成“Generate Done”。
  5. 完成以上步骤后,在 “F:\opencv\vs2010”中用VS2010打开OpenCV.sln工程文件。
  6. Debug模式下,在“Solution”下面,“ALL_BUILD”右键,选择“rebuild”;若编译没有问题,“INSTALL”右键,运行“build”;
  7. Release模式下,在“Solution”下面,“ALL_BUILD”右键,选择“rebuild”;若编译没有问题,“INSTALL”右键,运行“build”;
  8. 至此,所有的Debug模式和Release模式的dll文件生成在 “F:\opencv\vs2010\bin” ,lib文件都已经生成在  “F:\opencv\vs2010\lib” 各自对应文件夹下面,可以直接调用使用。
  9. 后面就是正常的引用第三方库的设置,配置windows环境变量path,注意不是加到'bin"就行了,要加到对应的Debug和Release文件夹。
  10. 加入include目录,我在 “F:\opencv\vs2010”下面没有找到,直接加的“F:\opencv\build\include”。
  11. 加入库文件目录和所有库。

Comments

Popular posts from this blog

Ubuntu Installation Experience With Windows 8 preinstalled

How to get Xtion PRO LIVE work in Ubutun 14.04 with PCL

北美信用记录((Credit record) 的FAQ