Click here to Skip to main content
15,394,479 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I try to call this


private void FindLicensePlate(
           VectorOfVectorOfPoint contours, int[,] hierachy, int idx, IInputArray gray, IInputArray canny,
           List<IInputOutputArray> licensePlateImagesList, List<IInputOutputArray> filteredLicensePlateImagesList, List<RotatedRect> detectedLicensePlateRegionList,
           List<String> licenses)




to my button

private void button2_Click(object sender, EventArgs e)
        {

           
        }


but my VS2019 always give me this warning..

can you tell me where the problem is?

What I have tried:

i tried to give new keyword

FindLicensePlate fd = new FindLicensePlate();

in my button method, but it failed
Posted
Updated 1-Aug-22 23:40pm

The problem is that it can't find the class - it's not in the same namespace as your current code.
That may be it's in a different project in the current solution, in a external DLL, or just in a different namespace in another file in the current project.

Start by hovering the mouse over the error, and open the drop down that appears. If it has an "include" option, click that, and it should fix it.
If it doesn't, you need to find out where that class is, and add a reference to uit, either via the project in the same solution, or via the DLL, and then add the appropriate using line to the top of all files that reference it.
   
Common causes of it:
1. you might not have added the required using directive
2. you might have forgotten to reference (-reference) the assembly that contains the type
3. there might be an issue with the assembly you are trying to reference

Look at them one by one and you should be able to zero down on its cause.

Other possible reasons:
1. Did you use a variable or some other language element where a type was expected?
2. Did you reference the assembly that was built against a higher framework version than the target framework of the program?
3. Did you use a using alias directive without fully qualifying the type name?
4. If you get this error in code that was previously working, first look for missing or unresolved references in Solution Explorer. Like - do you need to reinstall a NuGet package?

Reference: Compiler Error CS0246 | Microsoft Docs[^]
   
In my case, I had to removed and add again the reference to the project I was trying to import, in the target project. I think I added the faulty class from an existing file and I am not sure VisualStudio properly added it to the project initially.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900