fatal error C1189: #error : core.hpp header must be compiled as C++

两次opencv工程需要设置为C++编译:找了一半天的解决方法。

I am building a C application that uses OpenCV.

when compiling, I get the following error:

fatal error C1189: #error :  core.hpp header must be compiled as C++

I did not find how to resolve this error.

How to use OpenCV from a C project?

  1. Select the required file.
  2. Launch its properties window
  3. Goto C/C++ -> Advanced, and change Compile as to Compile as C++ Code (/TP)

enter image description here

原文地址:https://www.cnblogs.com/ranjiewen/p/6296617.html