Solve the problem that VS2022 needs to reconfigure opencv every time a new project is created

Solve the problem that VS2022 needs to reconfigure opencv every time a new project is created

The reason for this is that after I configure opencv according to other opencv tutorials on the Internet, every time I recreate a programming project, I need to reconfigure opencv again. After searching for a solution, I have not found an effective solution. Finally, I refer to the old version vs. The method of configuring opencv, Finally solved it, the solution is as follows:

First of all, the key point of the problem is in the step of configuring the include path. Other tutorials basically let the project be created to configure this project directly, which also makes other projects unable to inherit the configuration results, so we should directly configure the system property table instead. It's not just a configuration for a single project.

The download, installation, and environment variable configuration of other installation packages will not be described in detail. If necessary, you can refer to other tutorials on the Internet. Here we only share the key problem-solving steps

1. Create a new project for configuration

After the creation is successful, the solution explorer is as follows

2. Configuration steps (this step is the key)

This step is the key to solving the problem. Other tutorials on the Internet are to click: Project -> Properties and then configure on the configuration page, so that the configuration is only for a single project, and what we have to do is to configure the entire system.

So what should be selected is: Click View -> Other Windows -> Property Manager

After clicking, the project explorer will become a property manager

 Click on the project name to expand

Select "opencv configuration" and then right-click and select Add New Project Property Sheet

Change the name to opencv_config in the pop-up box

 Then click Add in the lower right corner

Then expand Debug|x64, select opencv config, right-click and select Properties, and the property page will pop up

 

Then follow the normal steps to configure the include directory, library directory, and additional dependencies. After the configuration is complete, save and exit.

3. Every time you create a new project, you only need to import our opencv config attribute table to configure opencv with one click

For example, create a new project: opencv experiment

Also come to the property manager by clicking View->Other Windows->Property Manager

Right-click "opencv experiment" and select: Add an existing attribute table, and then come to the attribute table selection box,

Then find the "opencv configuration" we created when we configured openc according to the location where we store the project

Click twice to enter the folder to find the attribute table we configured before

 Select and click -> Open to add successfully, you can see that our attribute table has been added

 In this way, we have successfully configured opencv in one step, and there is no need to repeat the configuration step by step.

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_46314573/article/details/127132650