Switch-compiling between OpenCV1.1 and OpenCV2.1 in VS2008

Sometime I used to get trouble while switch-compiling between OpenCV1.1 and OpenCV2.1 project on Visual Studio 2008. It is due to some projects run well on OpenCV1.1, while some other projects are perform well on OpenCV2.1. Here are a few things need to be set when we are going to switch the OpenCV library.

1. OpenCV1.1

On Visual Studio 2008, click Tools ⇒ Option ⇒ Project and Solution (at the left side bar) ⇒ VC++ directory. Choose the “Include file” and put some of the below folder path :

  • ..\OpenCV\cv\include                   (eg. C:\Program Files\OpenCV\cv\include)
  • ..\OpenCV\cvaux\include           (eg. C:\Program Files\OpenCV\cvaux\include)
  • ..\OpenCV\cxcore\include         (eg. C:\Program Files\OpenCV\cxcore\include)
  • ..\OpenCV\otherlibs\highgui     (eg. C:\Program Files\OpenCV\otherlibs\highgui)
Choose the “Library file” and put the below path:
  • ..\OpenCV\lib     (eg. C:\Program Files\OpenCV\lib)
Then, open a project, click the Project bar (on the top) ⇒ Property. At the left side, click the Configuration Property ⇒ Linker ⇒ Input. Put the below .lib files onto the Additional Dependencies row:
  • cv.lib
  • cvaux.lib
  • cxcore.lib
  • highgui.lib
2. OpenCV2.1

On Visual Studio 2008, click Tools ⇒ Option ⇒ Project and Solution (at the left side bar) ⇒ VC++ directory. Choose the “Include file” and put the below folder path :

  • ..\OpenCV2.1\include\opencv    (eg. C:\OpenCV2.1\include\opencv)
Choose the “Library file” and put the below path:
  • ..\OpenCV2.1\lib     (eg. C:\Program Files\OpenCV2.1\lib)
Then, open a project, click the Project bar (on the top) ⇒ Property. At the left side, click the Configuration Property ⇒ Linker ⇒ Input. Put the below .lib files onto the Additional Dependencies row:
  • cv210.lib
  • cvaux210.lib
  • cxcore210.lib
  • highgui210.lib

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: