• Welcome to Rotar E@rth!
  • Feel free to look around and comment~
  • Tin - for a better fantasy life!
  • TinTimer - for an even better fantasy life!

总算在64位Win7下VS2010里把OpenCV 2.1运行库正确地编译安装完了(附安装指南)| Finally finished building the correct OpenCV 2.1 libraries in Visual Studio 2010 under Windows 7 64bit (Install guide added)

Software Rotar 1372 Views 1 Comment

由于Project需要用到OpenCV的库,所以折腾数周,总算搞定了,期间试了无数次,OpenCV的库每次都能在Debug和Release下全部编译成功。但自己新建的工程无论如何修改配置都会出现LNK的fatal error,股沟多次得出结论:库文件添加错误。但是对照之后发现一模一样,于是郁闷多日不得解。今日再做尝试,在CMake中选择了“Visual Studio 2010”而不是之前的“Visual Studio 2010 Win64”,generate,然后打开VS进行Rebuild,添加到自己的工程之后奇迹般的成功了。于是在此记上一笔,免得他人步上俺的后尘。末尾附上英文安装过程。

————————–Lang Sep——————————–

I’ve been trying to get OpenCV installed on my laptop for a couple of weeks. I’m in need of it because of my project. The installation needs the OpenCV source files to be compiled into libraries and then will it be used in my own C project. I’ve tried several times of compiling and all results showed me that the building was successful. However, when I use the files in my own project, Visual studio kept telling me ‘LNKXXXX fatal error’ and never build my program. I was about to despair of trying it on Win7 64bit when I gave it a last try. This time, I selected “Visual Studio 2010” in the configure rather than “Visual Studio 2010 Win64” as I previous did. The result was amazing. After the libraries were generated, I managed to build my program and run it. Here’s the process for vs2010:

  1. Download the latest OpenCV source file and CMake. Make sure you have a compiler (Visual Studio or Visual C++.) If not, go to Microsoft to download a Visual C++ Express 2010 for free.
  2. Extract the files of OpenCV and install CMake. Run it and enter the path into “Where is the source code” also enter a path where you want the project file to be into “Where to build the binaries”. Tick the following:
    • “BUILD_TEST”,
    • “BUILD_SHARED_LIBS”,
    • ”OPENCV_BUILD_3RDPARTY_LIBS”,
    • “WITH_JASPER”,
    • “WITH_JPEG”,
    • “WITH_PNG”,
    • “WITH_TIFF”
  3. Press “configurate”. Select “Visual Studio 2010”and click “generate”.
  4. Go to the second path and open the *.sln file. Rebuild the solution in both Debug and Release mode.
  5. Add both “Debug” and “Release” in the bin folder of the second path in to the PATH of system environmental variables.
  6. In your own project, set as following:
    • Project –> Project Name –> Properties…Configuration Properties -> VC++ Directories
    • Include Directories… add: ‘C:OpenCV2.1includeopencv;’
    • Library Directories… add: ‘C:OpenCV2.1lib;’
    • Source Directories… add: ‘C:OpenCV2.1srccv; C:OpenCV2.1srccvaux; C:OpenCV2.1srccxcore; C:OpenCV2.1srchighgui; C:OpenCV2.1srcml;
    • Linker -> Input -> Additional Dependencies…
      • For Debug Builds.. add: ‘cv210d.lib; cxcore210d.lib; highgui210d.lib;’
      • For Release Builds.. add: ‘cv210.lib; cxcore210.lib; highgui210.lib;’

For more information of installation, please go to OpenCV Wiki: Install Guide.


Like (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(1)个小伙伴在吐槽
  1. Yep. Sounds good. Couldn't agree more.
    Emmie Varillas2010-12-10 16:19 Reply 未知操作系统 | 未知浏览器