Property Manger,配置我们自己的lib.

来源:互联网 发布:h是几g网络 编辑:程序博客网 时间:2024/06/05 21:07

Property Manger. You can bring up this with View ‣ Property Pages. Expand it and you can see the existing rule packages (calledProporty Sheets).An example of Property Sheet


The really useful stuff of these is that you may create a rule packageonce and you can later just add it to your new projects. Create it once and reuse it later,相当于eclipse中的自定义lib 库We want to create a newProperty Sheet that will contain all the rules that the compiler and linker needs to know. Of course we will need a separate one for the Debug and the Release Builds. Start up with the Debug one as shown in the image below:

Add a new Property Sheet

Use for example the OpenCV_Debug name. Then by selecting the sheet Right Click ‣ Properties. In the following I will show to set the OpenCV rules locally, as I find unnecessary to pollute projects with custom rules that I do not use it. Go the C++ groups General entry and under theAdditional Include Directories add the path to your OpenCV include. If you don’t have“C/C++” group, you should add any .c/.cpp file to the project.

$(OPENCV_DIR)\..\..\include
Add the include dir like this.

When adding third party libraries settings it is generally a good idea to use the power behind the environment variables. The full location of the OpenCV library may change on each system. Moreover, you may even end up yourself with moving the install directory for some reason. If you would give explicit paths inside your property sheet your project will end up not working when you pass it further to someone else who has a different OpenCV install path. Moreover, fixing this would require to manually modifying every explicit path. A more elegant solution is to use the environment variables. Anything that you put inside a parenthesis started with a dollar sign will be replaced at runtime with the current environment variables value. Here comes in play the environment variable setting we already made in our previous tutorial.

Next go to the Linker ‣ General and under the Additional Library Directories” add the libs directory:

$(OPENCV_DIR)\lib
Add the library folder like this.

Then you need to specify the libraries in which the linker should look into. To do this go to theLinker ‣ Input and under the “Additional Dependencies”entry add the name of all modules which you want to use:

Add the debug library names here.Like this.