Ask Your Question
1

Release Mode - "error C1083: Cannot open include file: 'opencv2/core/core.hpp': No such file or directory"

asked 2013-04-16 11:05:50 -0500

Constantin gravatar image

Hi! I want to use opencv with release mode in VS2012 but I get the mentioned error! I worked with debug mode and it was ok! can anyone help?

edit retag flag offensive close merge delete

Comments

1

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 ?

Alexandre Bizeau gravatar imageAlexandre Bizeau ( 2013-04-16 11:10:51 -0500 )edit

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 gravatar imageConstantin ( 2013-04-16 12:55:34 -0500 )edit

@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.

Alexandre Bizeau gravatar imageAlexandre Bizeau ( 2013-04-16 12:59:43 -0500 )edit

4 answers

Sort by ยป oldest newest most voted
3

answered 2013-12-21 10:06:23 -0500

Michael Stahl gravatar image

I had the same problem, and found that my project was not set to the right configuration. The result was that I was looking at the configuration for "Release 64x" while the project was set to be a "Release Win32".

To set your project correctly use: Build -> Configuration Manager

Identify your project, and make sure it is set to fit what is in the "Active solution configuration" and "Active solution platform" at the top of the Configuration manager window.

If the value you need for "Platform" does not exist in the pull-down menu for the Platform field, select "New" and select the value from the "New Platform" field. At least, this what worked for me (I needed "x64" and it existed as an option in the "New Platform" choice list).

Good luck!

Michael

edit flag offensive delete link more

Comments

Thanks, this was exactly my recent problem with a new build configuration. I had it setup correctly as a new property page, but I didn't have it set up exactly the same in the Build->Configuration Manager for that project (i.e. I was using ARM and StaticRelease and it was saying ARM and Release still for that configuration). Tiny little gotcha, but time consuming to find. So thanks!

CGA gravatar imageCGA ( 2017-06-02 19:43:56 -0500 )edit
2

answered 2013-04-16 12:40:30 -0500

Probably if it was working in debug mode, you have included linker dll libraries. The names for the debug libraries all contain a d in their name. Remove the d if you want to build and run in release mode.

Also notice that if you just change the project settings to release mode in VS2010 and on, you need to reconfigure all settings for linker and C++ include directories.

edit flag offensive delete link more

Comments

Yes I knew and I did that! I got the same error! it's funny all the things are the same as debug mode but just need to remove a 'd' from the .lib files then it should works! but it didn't!

Constantin gravatar imageConstantin ( 2013-04-16 13:00:01 -0500 )edit

Please check when switching your debug to release that all your other project configurations are actually copied!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-16 14:10:05 -0500 )edit

How should I check it? I make a property sheet for the Release mode and added it to the Property Manager under Release part, my settings are : C:\OpenCV 2.4\opencv\build\include C:\OpenCV 2.4\opencv\build\include\opencv C:\OpenCV 2.4\opencv\build\include\opencv2 --- Linker->Additional Libraries: C:\OpenCV 2.4\opencv\build\x86\vc11\lib -- opencv_core244.lib -- Linker -> Input -> additional dependencies: opencv_highgui244.lib opencv_calib3d244.lib opencv_contrib244.lib opencv_features2d244.lib opencv_flann244.lib opencv_imgproc244.lib opencv_legacy244.lib opencv_ml244.lib opencv_nonfree244.lib opencv_objdetect244.lib opencv_photo244.lib opencv_stitching244.lib opencv_ts244.lib opencv_video244.lib opencv_videostap244.lib

---- So i totally confused!

Constantin gravatar imageConstantin ( 2013-04-18 08:18:37 -0500 )edit

Do you use a x32 bit or a x64 bit system? Is this also configured correctly in your property manager? Did you add your libraries source path to your systems PATH variable?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-18 13:26:31 -0500 )edit

how should I set that I'm using x32 bit system!? all dlls that corresponds to the release mode is in lib directory. and they correctly added to the path variable!(as I did for debug mode)

Constantin gravatar imageConstantin ( 2013-04-19 11:11:53 -0500 )edit
1

Look at google : changing windows path variable, it gives you tons of guides how to do it.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-21 10:17:34 -0500 )edit
0

answered 2015-05-15 08:57:45 -0500

Sheng Liu gravatar image

updated 2015-05-16 08:27:05 -0500

Maybe it is a bug of VS 2012. And finally I find a solutation. There is a file Microsoft.Cpp.Win32.user.props in C:\Users\Administrator\AppData\Local\Microsoft\MSBuild\v4.0. We can write code in it directly to change settings. The code is shown below.

 <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets">
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup>
    <IncludePath>D:\2411\opencv\build\include;D:\2411\opencv\build\include\opencv;D:\2411\opencv\build\include\opencv2;$(IncludePath)</IncludePath>
    <LibraryPath>D:\2411\opencv\build\x86\vc12\lib;D:\2411\opencv\build\x86\vc12\staticlib;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
  <ItemDefinitionGroup>
    <ClCompile>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
    </ClCompile>
    <Link>
      <AdditionalDependencies>opencv_calib3d2411d.lib;opencv_contrib2411d.lib;opencv_core2411d.lib;opencv_features2d2411d.lib;opencv_flann2411d.lib;opencv_gpu2411d.lib;opencv_highgui2411d.lib;opencv_imgproc2411d.lib;opencv_legacy2411d.lib;opencv_ml2411d.lib;opencv_nonfree2411d.lib;opencv_objdetect2411d.lib;opencv_ocl2411d.lib;opencv_photo2411d.lib;opencv_stitching2411d.lib;opencv_superres2411d.lib;opencv_ts2411d.lib;opencv_video2411d.lib;opencv_videostab2411d.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>D:\2411\opencv\build\x86\vc12\lib;D:\2411\opencv\build\x86\vc12\staticlib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup />
</Project>
edit flag offensive delete link more
0

answered 2013-12-23 21:19:50 -0500

fwuwind gravatar image

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!

edit flag offensive delete link more

Comments

I had the same problem!

Sheng Liu gravatar imageSheng Liu ( 2015-05-15 07:24:21 -0500 )edit

I don't understand why some people doesn't not want to use CMAKE with VS2010-2012-2013-2015

LBerger gravatar imageLBerger ( 2015-05-15 10:15:32 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-04-16 11:05:50 -0500

Seen: 8,772 times

Last updated: May 16 '15