I had the same problem. It might be a bug of VS2012.
I use property sheets to config OpenCV settings. When I was creating the property pages earlier today, the VS2012 crashed. Then I came back and finished the sheets, and found the problem.
I double checked the settings both Debug and Release in VS2012. Both of them showed the correct include directories, but the Release mode failed to compile. I could open the header files in text editor through context menu under Release mode, so I think the IDE known the path but the compiler didn't.
Then I restarted VS2012, and I saw wave lines below the #include directives, only in Release mode. The property page settings vanished. Then I edited and restarted, and settings vanished again. After I compared the property sheets, I found the property file was broken. The broken file contained something like "< ItemDefinitionGroup />", which might be illegal format. I didn't save the broken file, so it's might not be the exact text, but this one does reproduce the problem. With this broken file, VS2012 cannot save settings. It neither emits a warning nor rebuilds the file, but shows as if it have saved the file. It is definitely a bug.
After repaired the property file, the problem solved in my computer. I wish you the best of luck!
You didn't provide that much information. Have look at your project Include Directories with good Configuration (Release) and Platform ? Same for your Library Directories and into linker Input ?
Sorry what do mean by good configuration.all the include directories are the same for both release and debug mode(as I know!)! so I added build\include\opencv and build\include\opencv2 to my include directory!
@Constantin Like Steven post as answer, you have to change Lib in linker. Because there Debug and release compiled lib. This is the only thing I see. Else provide more information.